niieani / puppeteer-intercept-and-modify-requests

The best way to intercept and modify requests done by a Chromium website when instrumented by puppeteer
Apache License 2.0
48 stars 8 forks source link

Errors that occur on pages that redirect. #10

Closed k-s-h-r closed 1 year ago

k-s-h-r commented 1 year ago

The following error occurs on the redirected page ProtocolError: Protocol error (Fetch.getResponseBody): Can only get response body on requests captured after headers received.

The error could be avoided by including 3XX in the StatusCode check. if (!responseStatusCode) -> if (!responseStatusCode || responseStatusCode === 302) {

niieani commented 1 year ago

Wanna file a PR with the fix? There's probably a few other status codes that don't expect a body.