Skip to content

Commit

Permalink
test: add failing test for request interception with sync XHRs
Browse files Browse the repository at this point in the history
`Network.requestWillBeSent` is not issued for the redirect inside
sync XHRs.

References puppeteer#4337.
  • Loading branch information
aslushnikov committed Apr 26, 2019
1 parent d64f700 commit 5a4e497
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/requestinterception.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
const response = await page.goto(server.EMPTY_PAGE);
expect(response.ok()).toBe(true);
});
// @see https://github.com/GoogleChrome/puppeteer/issues/4337
xit('should work with redirect inside sync XHR', async({page, server}) => {
await page.goto(server.EMPTY_PAGE);
server.setRedirect('/logo.png', '/pptr.png');
await page.setRequestInterception(true);
page.on('request', request => request.continue());
const status = await page.evaluate(async () => {
const request = new XMLHttpRequest();
request.open('GET', '/logo.png', false); // `false` makes the request synchronous
request.send(null);
return request.status;
});
expect(status).toBe(200);
});
it('should works with customizing referer headers', async({page, server}) => {
await page.setExtraHTTPHeaders({ 'referer': server.EMPTY_PAGE });
await page.setRequestInterception(true);
Expand Down

0 comments on commit 5a4e497

Please sign in to comment.