Skip to content

Commit

Permalink
fix: update isJSON test in request lib
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Dec 19, 2023
1 parent 9324a75 commit 506d7be
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/request.js
Expand Up @@ -37,7 +37,8 @@ async function call(url, method, { body, timeout, jar, ...config } = {}) {

const { headers } = response;
const contentType = headers.get('content-type');
const isJSON = contentType && contentType.indexOf('application/json') !== -1;
const jsonTest = /application\/([a-z]+\+)?json/;
const isJSON = contentType && jsonTest.test(contentType);
let respBody = await response.text();
if (isJSON && respBody) {
try {
Expand Down

0 comments on commit 506d7be

Please sign in to comment.