1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-27 16:10:57 -05:00
denoland-deno/http/readers_test.ts

13 lines
454 B
TypeScript
Raw Normal View History

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");
});