3 ms·
I agree that it might never be parsed/you might not want to, and that it shouldn’t be done implicitly. But I’m not sure why that requires await instead of just
by mcintyre1994 5y ago
I agree that it might never be parsed/you might not want to, and that it shouldn’t be done implicitly. But I’m not sure why that requires await instead of just a plain function call to parse it explicitly.
- pininja 5y agoParsing JSON is synchronous, but fetch itself doesn’t read the body data. > [1] to parse the body as JSON, first the body data has to be read from the incoming stream. And, since reading from the TCP stream is asynchronous, the .json() operation ends up asynchronous. [1] https://stackoverflow.com/a/59555579 https://stackoverflow.com/a/59555579
- mcintyre1994 5y agoIs that basically the same point at a lower level though? I don't think reading the stream involves a round trip?