Re: [whatwg/fetch] Add a textStream() method to the Body mixin (PR #1862)

@foolip commented on this pull request.



> @@ -8246,6 +8250,20 @@ of running <a for=Body>consume body</a> with <a>this</a> and <a>parse JSON from
 of running <a for=Body>consume body</a> with <a>this</a> and <a>UTF-8 decode</a>.
 </div>
 
+<div algorithm>
+<p>The <dfn method for=Body><code>textStream()</code></dfn> method steps are:</p>

Ah, I didn't realize what `text()` does if `this.body` is null. I agree an empty stream would be better, code that doesn't consider this case would likely just work.

I thought this should behave like when you try to use both `blob()` and `bytes()`, or indeed call one of those twice. That throws a TypeError in the first step of https://fetch.spec.whatwg.org/#concept-body-consume-body.

Since it's not possible to call `text()` twice, should it really be possible to call `text()` after `textStream()`?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1862#discussion_r2399175135
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1862/review/3295127186@github.com>

Received on Thursday, 2 October 2025 15:11:07 UTC