mirror of
https://github.com/denoland/deno.git
synced 2024-11-23 15:16:54 -05:00
57f4e6a864
Original: 8569f15207
12 lines
454 B
TypeScript
12 lines
454 B
TypeScript
import { assert, runTests, test } from "../testing/mod.ts";
|
|
import { ChunkedBodyReader } from "./readers.ts";
|
|
import { StringReader } from "../io/readers.ts";
|
|
import { Buffer, copy } from "deno";
|
|
|
|
test(async function httpChunkedBodyReader() {
|
|
const chunked = "3\r\nabc\r\n5\r\ndefgh\r\n0\r\n\r\n";
|
|
const r = new ChunkedBodyReader(new StringReader(chunked));
|
|
const w = new Buffer();
|
|
await copy(w, r);
|
|
assert.equal(w.toString(), "abcdefgh");
|
|
});
|