Merge pull request #6261 from GoWind/techdocs-fetch-with-credentials
Techdocs: Include cookies when requesting SVGs
This commit is contained in:
@@ -154,6 +154,9 @@ describe('addBaseUrl', () => {
|
||||
await waitFor(() => {
|
||||
const actualSrc = root.getElementById('x')?.getAttribute('src');
|
||||
expect(expectedSrc).toEqual(actualSrc);
|
||||
expect(global.fetch).toHaveBeenCalledWith(`${API_ORIGIN_URL}/test.svg`, {
|
||||
credentials: 'include',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ export const addBaseUrl = ({
|
||||
const apiOrigin = await techdocsStorageApi.getApiOrigin();
|
||||
if (isSvgNeedingInlining(attributeName, elemAttribute, apiOrigin)) {
|
||||
try {
|
||||
const svg = await fetch(newValue);
|
||||
const svg = await fetch(newValue, { credentials: 'include' });
|
||||
const svgContent = await svg.text();
|
||||
elem.setAttribute(
|
||||
attributeName,
|
||||
|
||||
Reference in New Issue
Block a user