TE
TechEcho
Home
24h Top
Newest
Best
Ask
Show
Jobs
English
GitHub
Twitter
Home
Safe Data Fetching in Modern JavaScript
2 points
by
steve8708
over 2 years ago
1 comment
phillipseamore
over 2 years ago
One thing missing there, you can't be certain that the response is JSON, so I do a JSON.parse in a try/catch and parse response.text(), if it fails the catch returns the text in the promise.