Skip to content

Commit

Permalink
test: add redirect+extraHTTPHeaders test (#2637)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman authored Jun 19, 2020
1 parent d0336ea commit 53f7f4e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/network.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('Page.Events.Request', function() {
expect(requests.length).toBe(2);
});
it('should report requests and responses handled by service worker', async({page, server}) => {
// Firefox issues Network.requestWillBeSent and nothing else.
await page.goto(server.PREFIX + '/serviceworkers/fetchdummy/sw.html');
await page.evaluate(() => window.activationPromise);
const [swResponse, request] = await Promise.all([
Expand Down Expand Up @@ -412,6 +411,17 @@ describe('Page.setExtraHTTPHeaders', function() {
]);
expect(request.headers['foo']).toBe('bar');
});
it('should work with redirects', async({page, server}) => {
server.setRedirect('/foo.html', '/empty.html');
await page.setExtraHTTPHeaders({
foo: 'bar'
});
const [request] = await Promise.all([
server.waitForRequest('/empty.html'),
page.goto(server.PREFIX + '/foo.html'),
]);
expect(request.headers['foo']).toBe('bar');
});
it('should work with extra headers from browser context', async({browser, server}) => {
const context = await browser.newContext();
await context.setExtraHTTPHeaders({
Expand Down

0 comments on commit 53f7f4e

Please sign in to comment.