Skip to content

Commit

Permalink
fix: wait only for HTML content
Browse files Browse the repository at this point in the history
  • Loading branch information
ido-pluto committed Dec 25, 2023
1 parent 7ab7ee4 commit 331937b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/forms/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export default function astroForms(settings: Partial<FormsSettings> = {}) {
await ensureValidationSecret(likeAstro);
response = await next();

if (!locals.webFormOff) {
const isHTML = response.headers.get('Content-Type')?.includes('text/html');
if (!locals.webFormOff && isHTML) {
try {
const pageFinishedPromise = new Promise(resolve => pageFinished = resolve);
await timeout(pageFinishedPromise, FORM_OPTIONS.pageLoadTimeoutMS);
Expand Down

0 comments on commit 331937b

Please sign in to comment.