fix(network): stringify response headers for intercepted requests (#4436)

Stringifying the headers was the behaviour before v1.15

References #4379
This commit is contained in:
Jake Causon
2019-05-20 09:05:32 +01:00
committed by Andrey Lushnikov
parent 3f19bd57a5
commit 90a1032300
3 changed files with 20 additions and 3 deletions

View File

@@ -506,6 +506,23 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
const img = await page.$('img');
expect(await img.screenshot()).toBeGolden('mock-binary-response.png');
});
it('should stringify intercepted request response headers', async({page, server}) => {
await page.setRequestInterception(true);
page.on('request', request => {
request.respond({
status: 200,
headers: {
'foo': true
},
body: 'Yo, page!'
});
});
const response = await page.goto(server.EMPTY_PAGE);
expect(response.status()).toBe(200);
const headers = response.headers();
expect(headers.foo).toBe('true');
expect(await page.evaluate(() => document.body.textContent)).toBe('Yo, page!');
});
});
};