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

isJson method in JSON Interceptor is not spec compliant. #665

Closed
ghost opened this issue Dec 13, 2017 · 1 comment
Closed

isJson method in JSON Interceptor is not spec compliant. #665

ghost opened this issue Dec 13, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 13, 2017

Reproduction

Passing this payload to the isJson interceptor method: "↵[{"foo":"bar"}] (Where is %x0A or new line) evaluates to false.

What is Expected?

Per the spec on https://tools.ietf.org/html/rfc7159#page-5 : "Insignificant whitespace is allowed before or after any of the six structural characters.", thus this should evaluate to true.

EDIT:

I suggested to add \s* to the regex, but this doesn't include the fact that true, false, null, numbers and string literals are also valid. Although I suspect that including string and number literals is not desirable.
https://github.com/pagekit/vue-resource/blob/master/src/http/interceptor/json.js#L43

@steffans
Copy link
Member

Thanks, fixed in v1.3.5

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant