fix(webkit): deduce response mime type from content-type (#9264)

This commit is contained in:
Yury Semikhatsky 2021-10-01 13:04:03 -07:00 committed by GitHub
parent 235eaca34a
commit 1b4adfb916
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -130,7 +130,7 @@ export class WKRouteImpl implements network.RouteDelegate {
// In certain cases, protocol will return error if the request was already canceled
// or the page was closed. We should tolerate these errors.
let mimeType = response.isBase64 ? 'application/octet-stream' : 'text/plain';
const headers = headersArrayToObject(response.headers, false /* lowerCase */);
const headers = headersArrayToObject(response.headers, true /* lowerCase */);
const contentType = headers['content-type'];
if (contentType)
mimeType = contentType.split(';')[0].trim();

View File

@ -225,7 +225,7 @@ it('should fulfill with fetch result and overrides', async ({ page, server, isEl
response,
status: 201,
headers: {
...response.headers(),
'Content-Type': 'application/json', // Case matters for the tested behavior
'foo': 'bar'
}
});