0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Revert "Changed request type to fetching iframe content in previews

refs https://ghost.slack.com/archives/C0568LN2CGJ/p1706018058495729
This commit is contained in:
Ronald Langeveld 2024-01-23 14:33:38 +00:00 committed by Steve Larson
parent 109a354818
commit 181be4ef1b
5 changed files with 5 additions and 5 deletions

View file

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

View file

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

View file

@ -65,7 +65,7 @@ const ThemePreview: React.FC<ThemePreviewProps> = ({settings,url}) => {
// Fetch theme preview HTML // Fetch theme preview HTML
fetch(url, { fetch(url, {
method: 'GET', method: 'POST',
headers: { headers: {
'Content-Type': 'text/html;charset=utf-8', 'Content-Type': 'text/html;charset=utf-8',
'x-ghost-preview': previewData, '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 iframesHandleHome = await page.$$('[data-testid="announcement-bar-preview-iframe"] > iframe');
const textExistsInHomeIframes = await checkTextInIframes(iframesHandleHome, 'homepage preview'); const textExistsInHomeIframes = await checkTextInIframes(iframesHandleHome, 'homepage preview');
await expect(textExistsInHomeIframes).toBeTruthy(); expect(textExistsInHomeIframes).toBeTruthy();
const modal = page.getByTestId('announcement-bar-modal'); const modal = page.getByTestId('announcement-bar-modal');
await modal.getByTestId('design-toolbar').getByRole('tab', {name: 'Post'}).click(); 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(); await expect(modal.getByTestId('design-setting-tabs').getByRole('tab', {name: 'Post'})).toBeHidden();
const expectedEncoded = new URLSearchParams([['custom', JSON.stringify({})]]).toString(); const expectedEncoded = new URLSearchParams([['custom', JSON.stringify({})]]).toString();
await expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`)); expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`));
}); });
test('Custom theme setting visibility', async ({page}) => { test('Custom theme setting visibility', async ({page}) => {