test: update wk win expectations for "should report raw headers" (#11558)

This commit is contained in:
Yury Semikhatsky 2022-01-21 21:49:28 -08:00 committed by GitHub
parent baf0e5b47a
commit 8a7e4f9814
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);