News for hackers. Stuff that matters.
Re:JavaScript async/await implemented in V8 by Kiro on Tuesday May 17, 2016 @05:06AM (#11712161)
Why do you need to put await before res.json?
Re:JavaScript async/await implemented in V8 by tomelders on Tuesday May 17, 2016 @05:12AM (#11712178)
Someone correct me if I'm wrong here, this is just my hunch - but according to the fetch spec, res.json returns a promise, which are async. I'm assuming so you have the chance to handle errors as a result of malformed JSON.
Re:JavaScript async/await implemented in V8 by thomasahle on Tuesday May 17, 2016 @07:14AM (#11712597)
Promises are used for catching errors?
Re:JavaScript async/await implemented in V8 by onestone on Tuesday May 17, 2016 @07:48AM (#11712766)
Yes.
Re:JavaScript async/await implemented in V8 by jwmerrill on Tuesday May 17, 2016 @08:30AM (#11713010)
At the time that the request resolves, it has received and processed the response headers, but it may still be receiving the response body (which is represented as a stream). All the body representations (like .text() or .json()) need to wait until the body has arrived before they can resolve.

https://fetch.spec.whatwg.org/#concept-body-consume-body