lib/grover/js/processor.js in grover-1.0.2 vs lib/grover/js/processor.js in grover-1.0.3

- old
+ new

@@ -143,14 +143,18 @@ await page.goto(urlOrHtml, requestOptions); } else { // Request is some HTML content. Use request interception to assign the body requestOptions.waitUntil = waitUntil || 'networkidle0'; await page.setRequestInterception(true); - page.once('request', request => { - request.respond({ body: urlOrHtml === '' ? ' ' : urlOrHtml }); - // Reset the request interception - // (we only want to intercept the first request - ie our HTML) - page.on('request', request => request.continue()); + let htmlIntercepted = false; + page.on('request', request => { + // We only want to intercept the first request - ie our HTML + if (htmlIntercepted) + request.continue(); + else { + htmlIntercepted = true + request.respond({ body: urlOrHtml === '' ? ' ' : urlOrHtml }); + } }); const displayUrl = options.displayUrl; delete options.displayUrl; await page.goto(displayUrl || 'http://example.com', requestOptions); }