Fixed response JSON detection when charset existed

Fixes #2684
This commit is contained in:
Dan Brown 2021-04-18 22:12:26 +01:00
parent e4660a5ba2
commit 0c880def5e
1 changed files with 2 additions and 2 deletions

View File

@ -149,8 +149,8 @@ async function getResponseContent(response) {
return null; return null;
} }
const responseContentType = response.headers.get('Content-Type'); const responseContentType = response.headers.get('Content-Type') || '';
const subType = responseContentType.split('/').pop(); const subType = responseContentType.split(';')[0].split('/').pop();
if (subType === 'javascript' || subType === 'json') { if (subType === 'javascript' || subType === 'json') {
return await response.json(); return await response.json();