Changed request type to fetching iframe content in previews (#19307)

refs PROD-227

- Swapped out the request type from `POST` to `GET`.
This commit is contained in:
Ronald Langeveld 2023-12-11 16:28:35 +02:00 committed by GitHub
parent 1f0d874ea2
commit 4c09a96a3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View File

@ -223,7 +223,7 @@ export async function mockSitePreview({page, url, response}: {page: Page, url: s
const lastRequest: {previewHeader?: string} = {};
await page.route(url, async (route) => {
if (route.request().method() !== 'POST') {
if (route.request().method() !== 'GET') {
return route.continue();
}

View File

@ -28,7 +28,7 @@ const AnnouncementBarPreview: React.FC<AnnouncementBarSettings> = ({announcement
}
fetch(url, {
method: 'POST',
method: 'GET',
headers: {
'Content-Type': 'text/html;charset=utf-8',
'x-ghost-preview': getPreviewData(

View File

@ -65,7 +65,7 @@ const ThemePreview: React.FC<ThemePreviewProps> = ({settings,url}) => {
// Fetch theme preview HTML
fetch(url, {
method: 'POST',
method: 'GET',
headers: {
'Content-Type': 'text/html;charset=utf-8',
'x-ghost-preview': previewData,

View File

@ -44,7 +44,7 @@ test.describe('Announcement Bar', async () => {
const iframesHandleHome = await page.$$('[data-testid="announcement-bar-preview-iframe"] > iframe');
const textExistsInHomeIframes = await checkTextInIframes(iframesHandleHome, 'homepage preview');
expect(textExistsInHomeIframes).toBeTruthy();
await expect(textExistsInHomeIframes).toBeTruthy();
const modal = page.getByTestId('announcement-bar-modal');
await modal.getByTestId('design-toolbar').getByRole('tab', {name: 'Post'}).click();

View File

@ -220,7 +220,7 @@ test.describe('Design settings', async () => {
await expect(modal.getByTestId('design-setting-tabs').getByRole('tab', {name: 'Post'})).toBeHidden();
const expectedEncoded = new URLSearchParams([['custom', JSON.stringify({})]]).toString();
expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`));
await expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`));
});
test('Custom theme setting visibility', async ({page}) => {