Skip to content

Commit

Permalink
fix(network): relax request matching heuristic
Browse files Browse the repository at this point in the history
Drop requirement for matching "origin" and "content-type" headers
in requests and request interceptions. This way javascript redirects
that use form submission start working.

Fix puppeteer#3684.
  • Loading branch information
aslushnikov committed Jan 15, 2019
1 parent 4e9e3bc commit d8f051a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/NetworkManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ function generateRequestHash(request) {
for (let header of headers) {
const headerValue = request.headers[header];
header = header.toLowerCase();
if (header === 'accept' || header === 'referer' || header === 'x-devtools-emulate-network-conditions-client-id' || header === 'cookie')
if (header === 'accept' || header === 'referer' || header === 'x-devtools-emulate-network-conditions-client-id' || header === 'cookie' || header === 'origin' || header === 'content-type')
continue;
hash.headers[header] = headerValue;
}
Expand Down
2 changes: 1 addition & 1 deletion test/network.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ module.exports.addTests = function({testRunner, expect}) {
expect(response.ok()).toBe(true);
expect(response.remoteAddress().port).toBe(server.PORT);
});
xit('should work when POST is redirected with 302', async({page, server}) => {
it('should work when POST is redirected with 302', async({page, server}) => {
server.setRedirect('/rredirect', '/empty.html');
await page.goto(server.EMPTY_PAGE);
await page.setRequestInterception(true);
Expand Down

0 comments on commit d8f051a

Please sign in to comment.