Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
allow whitespace before/after JSON issue #665
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffan committed Dec 20, 2017
1 parent 4ea87ef commit 8e4ef29
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/http/interceptor/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export default function (request, next) {

function isJson(str) {

var start = str.match(/^\[|^\{(?!\{)/), end = {'[': /]$/, '{': /}$/};
const start = str.match(/^\s*(\[|\{)/);
const end = {'[': /]\s*$/, '{': /}\s*$/};

return start && end[start[0]].test(str);
return start && end[start[1]].test(str);
}

0 comments on commit 8e4ef29

Please sign in to comment.