Skip to content

Commit b8303c7

Browse files
authored
refactor(op_crate/fetch): align streams to spec (#9103)
Fixes #8814
1 parent 2d12085 commit b8303c7

File tree

13 files changed

+3373
-3826
lines changed

13 files changed

+3373
-3826
lines changed

cli/tests/unit/fetch_test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,9 +1047,13 @@ unitTest(
10471047
const buf = bufferServer(addr);
10481048
const stream = new TransformStream();
10491049
const writer = stream.writable.getWriter();
1050-
await writer.write(new TextEncoder().encode("hello "));
1051-
await writer.write(new TextEncoder().encode("world"));
1052-
await writer.close();
1050+
// transformer writes don't resolve until they are read, so awaiting these
1051+
// will cause the transformer to hang, as the suspend the transformer, it
1052+
// is also illogical to await for the reads, as that is the whole point of
1053+
// streams is to have a "queue" which gets drained...
1054+
writer.write(new TextEncoder().encode("hello "));
1055+
writer.write(new TextEncoder().encode("world"));
1056+
writer.close();
10531057
const response = await fetch(`http://${addr}/blah`, {
10541058
method: "POST",
10551059
headers: [

cli/tests/unit/streams_internal_test.ts

Lines changed: 0 additions & 72 deletions
This file was deleted.

cli/tests/unit/streams_piping_test.ts

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)