mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[6.7] Use credentials: same-origin
when we fetch translations JSON. (#34127)
This commit is contained in:
parent
92c968cc13
commit
96d00fbe60
2 changed files with 6 additions and 2 deletions
|
@ -921,7 +921,7 @@ describe('I18n engine', () => {
|
|||
await expect(i18n.load('some-url')).resolves.toBeUndefined();
|
||||
|
||||
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetch).toHaveBeenCalledWith('some-url');
|
||||
expect(mockFetch).toHaveBeenCalledWith('some-url', { credentials: 'same-origin' });
|
||||
|
||||
expect(i18n.getTranslation()).toEqual(translations);
|
||||
});
|
||||
|
|
|
@ -240,7 +240,11 @@ export function init(newTranslation?: Translation) {
|
|||
* @param translationsUrl URL pointing to the JSON bundle with translations.
|
||||
*/
|
||||
export async function load(translationsUrl: string) {
|
||||
const response = await fetch(translationsUrl);
|
||||
// Once this package is integrated into core Kibana we should switch to an abstraction
|
||||
// around `fetch` provided by the platform, e.g. `kfetch`.
|
||||
const response = await fetch(translationsUrl, {
|
||||
credentials: 'same-origin',
|
||||
});
|
||||
|
||||
if (response.status >= 300) {
|
||||
throw new Error(`Translations request failed with status code: ${response.status}`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue