Skip to content

Commit

Permalink
fix: continue requests without network instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Apr 19, 2023
1 parent 5547e43 commit ad7cc4c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/puppeteer-core/src/common/NetworkManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ export class NetworkManager extends EventEmitter {
const {networkId: networkRequestId, requestId: fetchRequestId} = event;

if (!networkRequestId) {
this.#client
.send('Fetch.continueRequest', {
requestId: event.requestId,
})
.catch(debugError);
return;
}

Expand Down
12 changes: 12 additions & 0 deletions test/src/requestinterception.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ describe('request interception', function () {
expect(requests[1]!.url()).toContain('/one-style.css');
expect(requests[1]!.headers()['referer']).toContain('/one-style.html');
});
it('should work with requests without networkId', async () => {
const {page, server} = getTestState();
await page.goto(server.EMPTY_PAGE);
await page.setRequestInterception(true);
page.on('request', request => {
return request.continue();
});
const cdp = await page.target().createCDPSession();
await cdp.send('DOM.enable');
// This causes network requests without networkId.
await cdp.send('CSS.enable');
});
it('should properly return navigation response when URL has cookies', async () => {
const {page, server} = getTestState();

Expand Down

0 comments on commit ad7cc4c

Please sign in to comment.