mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
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:
committed by
Andrey Lushnikov
parent
3f19bd57a5
commit
90a1032300
@@ -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!');
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user