(body: RequestBody, rid: number)
| 187 | } |
| 188 | |
| 189 | private async writeBody(body: RequestBody, rid: number) { |
| 190 | let buf = new Uint8Array(1024 * 10); |
| 191 | while (true) { |
| 192 | let read = await body.read(buf); |
| 193 | if (read > 0) { |
| 194 | let written = await Deno.core.write(rid, buf.subarray(0, read)); |
| 195 | if (written < read) { |
| 196 | return |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | if (read === 0) { |
| 201 | return |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | async sendJson(data: any) { |
| 207 | const serialized = encodeText(JSON.stringify(data)); |