- From: Domenic Denicola <notifications@github.com>
- Date: Wed, 01 Jul 2015 04:17:43 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/61/117613751@github.com>
@annevk re https://github.com/whatwg/fetch/issues/61#issuecomment-115376269 > a) checks for the offset to be 0 in https://github.com/whatwg/streams/issues/367 and linked comments, the plan was to compare offset at construction time with offset at fetch/cache.put/etc. time, not to check that it's always zero. But I guess that is the subject of https://github.com/whatwg/streams/issues/367#issuecomment-115428031 so for "v1" we will check it's zero? > Here are some examples to show what this means: Yay, these are very helpful! This transfer semantic is pretty interesting and I guess does help solve the problem. Here is one more example that I believe follows from yours: ```js req = new Request({body: someClosedReadableByteStream}) assert(req.body !== null) assert_false(req.bodyUsed) fetch(req) // success assert(req.body === null) // due to transfer assert_true(req.bodyUsed) // due to obsolete flag assert_reject(fetch(req)) // due to obsolete flag ``` i.e., this is equivalent to `{body: ""}`. --- However, I am afraid of the issue @yutakahirano pointed out in https://github.com/yutakahirano/fetch-with-streams/issues/37#issuecomment-115148298: ```js req = new Request({ body: "Hello world!" }); req.body.cancel(); // offset is zero since nothing has been read, so // now this is equivalent to the above case: req.body is just // a closed, zero-offset RBS. assert(req.body !== null); assert_false(req.bodyUsed); // !! fetch(req); // !! success assert(req.body === null) // due to transfer assert_true(req.bodyUsed) // due to obsolete flag assert_reject(fetch(req)) // due to obsolete flag ``` This situation seems fine to me, but I am afraid @wanderview will not like it, since author code managed to disturb the stream in some way and yet fetch still succeeded/bodyUsed is still false. --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/61#issuecomment-117613751
Received on Wednesday, 1 July 2015 11:18:13 UTC