Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fetch, instead xhr request #91

Closed
lukeapage opened this issue Dec 12, 2015 · 4 comments
Closed

Use fetch, instead xhr request #91

lukeapage opened this issue Dec 12, 2015 · 4 comments

Comments

@lukeapage
Copy link

Nice library!

It would be in keeping with the theme of the library to use fetch instead of xhr request - https://github.com/LeaVerou/bliss/blob/gh-pages/bliss.js#L263

You may want to just tell people to use fetch and not expose your own fetch object or wrap it and optionally return something more similiar to fetch (e.g. one annoyance I find is needing a 2nd promise on the result instead of just getting the contents and automatically JSON.parse if the content type is json).

Spec: https://fetch.spec.whatwg.org/
Polyfill: https://github.com/github/fetch

@kurtextrem
Copy link
Contributor

Hi, Lea already answered this one: #31 (first response).

@lukeapage
Copy link
Author

ok

@LeaVerou
Copy link
Owner

FWIW, you don't need to JSON.parse() if you use responseType: 'json'. And that's just native XHR functionality :)

@lukeapage
Copy link
Author

w.r.t. json parse I meant the fetch standard e.g. https://github.com/github/fetch#json
Ok you don't have to call json.Parse, you can use the json helper method, but it is not done automatically if the response type is 'json'

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

No branches or pull requests

3 participants