| 92 | } |
| 93 | |
| 94 | getBody(): ReadableStream<Uint8ArrayArrayBuffer> | null { |
| 95 | let body: ReadableStream<Uint8ArrayArrayBuffer> | null; |
| 96 | if (this.method === "GET" || this.method === "HEAD") { |
| 97 | body = null; |
| 98 | } else { |
| 99 | body = new ReadableStream<Uint8ArrayArrayBuffer>({ |
| 100 | start: (controller) => { |
| 101 | this.#request.on("data", (chunk) => { |
| 102 | controller.enqueue(chunk as Uint8ArrayArrayBuffer); |
| 103 | }); |
| 104 | this.#request.on("error", (err: Error) => { |
| 105 | controller.error(err); |
| 106 | }); |
| 107 | this.#request.on("end", () => { |
| 108 | controller.close(); |
| 109 | }); |
| 110 | }, |
| 111 | }); |
| 112 | } |
| 113 | return body; |
| 114 | } |
| 115 | |
| 116 | async respond(response: Response) { |
| 117 | if (this.#responded) { |