diff --git a/test/proxy.test.ts b/test/proxy.test.ts index bd874299..0c67e97b 100644 --- a/test/proxy.test.ts +++ b/test/proxy.test.ts @@ -165,22 +165,25 @@ describe("", () => { }) ); - const stream = new ReadableStream({ - start(controller) { - controller.enqueue("This "); - controller.enqueue("is "); - controller.enqueue("a "); - controller.enqueue("streamed "); - controller.enqueue("request."); - controller.close(); - }, - }).pipeThrough(new TextEncoderStream()); + const isNode16 = process.version.startsWith("v16."); + const body = isNode16 + ? "This is a streamed request." + : new ReadableStream({ + start(controller) { + controller.enqueue("This "); + controller.enqueue("is "); + controller.enqueue("a "); + controller.enqueue("streamed "); + controller.enqueue("request."); + controller.close(); + }, + }).pipeThrough(new TextEncoderStream()); const res = await fetch(url + "/", { method: "POST", // @ts-ignore duplex: "half", - body: stream, + body, headers: { "content-type": "application/octet-stream", "x-custom": "hello",