pagekit / vue-resource

The HTTP client for Vue.js
MIT License
10.08k stars 1.6k forks source link

JSON decoding #681

Closed niclan closed 6 years ago

niclan commented 6 years ago

Reproduction Link

https://jsfiddle.net/pjjr7e7m/25/

This appears to be how to use the .json() method though the docs does not have a direct example.

Steps to reproduce

Run the fiddle. The IP line should contain your IP number. The body line is sane. the fjson shows a function that appears to use JSON.parse the right way. The json line is a rather empty promise structure. The IP line is empty.

What is Expected?

The IP line should contain your IP number.

What is actually happening?

The json decoding seems to return the wrong kind of thing and then everything is off.

steffans commented 6 years ago

Works as expected check my comments, https://jsfiddle.net/pjjr7e7m/38/

niclan commented 6 years ago

Please include example in the docs/cookbook. That progression of calls was no-where close to what I could read out of the docs.

Thanks for your help.