yutakahirano/fetch-with-streams

can Response.body.cancel() terminate an ongoing Response.json()?

Closed this issue · 4 comments

It seems maybe Response.json() having a lock on the stream would prevent it from being canceled through body.cancel(). Is this ok?

cc / @domenic @annevk

That's why we'll have response.json().cancel(), no?

Maybe I got confused from this conversation about cancelable promises on #whatwg:

http://logs.glob.uno/?c=freenode%23whatwg#c957231

Response.body.cancel() is callable only when the body is not locked by anyone. Hence it is not callabled when Response.json() is running.

To answer the OP's question: yes, it would prevent it from being canceled (except by response.json().cancel(), i.e. eventual cancelable promises) and yes, this is OK.