Skip to content

Commit

Permalink
fix(requestinterception): filter out "intervention" header (#3814)
Browse files Browse the repository at this point in the history
Fixes #3798
  • Loading branch information
aslushnikov committed Jan 20, 2019
1 parent c48b574 commit 9fd4b67
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/NetworkManager.js
Expand Up @@ -651,7 +651,7 @@ class Response {
}
helper.tracePublicAPI(Response);

const IGNORED_HEADERS = new Set(['accept', 'referer', 'x-devtools-emulate-network-conditions-client-id', 'cookie', 'origin', 'content-type']);
const IGNORED_HEADERS = new Set(['accept', 'referer', 'x-devtools-emulate-network-conditions-client-id', 'cookie', 'origin', 'content-type', 'intervention']);

/**
* @param {!Protocol.Network.Request} request
Expand Down
18 changes: 18 additions & 0 deletions test/network.spec.js
Expand Up @@ -266,6 +266,24 @@ module.exports.addTests = function({testRunner, expect}) {
expect(response.ok()).toBe(true);
expect(response.remoteAddress().port).toBe(server.PORT);
});
it('should work with intervention headers', async({page, server}) => {
server.setRoute('/intervention', (req, res) => res.end(`
<script>
document.write('<script src="${server.CROSS_PROCESS_PREFIX}/intervention.js">' + '</scr' + 'ipt>');
</script>
`));
server.setRedirect('/intervention.js', '/redirect.js');
let serverRequest = null;
server.setRoute('/redirect.js', (req, res) => {
serverRequest = req;
res.end('console.log(1);');
});

await page.setRequestInterception(true);
page.on('request', request => request.continue());
await page.goto(server.PREFIX + '/intervention');
expect(serverRequest.headers.intervention).toContain('www.chromestatus.com');
});
it('should work when POST is redirected with 302', async({page, server}) => {
server.setRedirect('/rredirect', '/empty.html');
await page.goto(server.EMPTY_PAGE);
Expand Down

0 comments on commit 9fd4b67

Please sign in to comment.