mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
test: update wk win expectations for "should report raw headers" (#11558)
This commit is contained in:
parent
baf0e5b47a
commit
8a7e4f9814
@ -272,8 +272,21 @@ it('should report raw headers', async ({ page, server, browserName, platform })
|
||||
expectedHeaders = [];
|
||||
for (let i = 0; i < req.rawHeaders.length; i += 2)
|
||||
expectedHeaders.push({ name: req.rawHeaders[i], value: req.rawHeaders[i + 1] });
|
||||
if (browserName === 'webkit' && platform === 'win32')
|
||||
expectedHeaders = expectedHeaders.filter(({ name }) => name.toLowerCase() !== 'accept-encoding' && name.toLowerCase() !== 'accept-language');
|
||||
if (browserName === 'webkit' && platform === 'win32') {
|
||||
expectedHeaders = expectedHeaders.filter(({ name }) => name.toLowerCase() !== 'accept-encoding');
|
||||
// Convert "value": "en-US, en-US" => "en-US"
|
||||
expectedHeaders = expectedHeaders.map(e => {
|
||||
const { name, value } = e;
|
||||
if (name.toLowerCase() !== 'accept-language')
|
||||
return e;
|
||||
const values = value.split(',').map(v => v.trim());
|
||||
if (values.length === 1)
|
||||
return e;
|
||||
if (values[0] !== values[1])
|
||||
return e;
|
||||
return { name, value: values[0] };
|
||||
});
|
||||
}
|
||||
res.end();
|
||||
});
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
Loading…
Reference in New Issue
Block a user