summaryrefslogtreecommitdiff
path: root/std/http/io_test.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-04-29 22:38:10 +0200
committerGitHub <noreply@github.com>2020-04-29 22:38:10 +0200
commitd308e8d0c0469419517e05a36ba070633168dc67 (patch)
tree1b9b76c8a443cb781f6c557e964ebae73d64c4bc /std/http/io_test.ts
parentb51c863550cb377f6e720bccf4f1485ed8d97222 (diff)
BREAKING: remove custom implementation of Deno.Buffer.toString() (#4992)
Keep in mind Buffer.toString() still exists, but returns [object Object]. Reason for removal of Buffer.toString() was that it implicitly used TextDecoder with fixed "utf-8" encoding and no way to customize the encoding.
Diffstat (limited to 'std/http/io_test.ts')
-rw-r--r--std/http/io_test.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/std/http/io_test.ts b/std/http/io_test.ts
index b9bb56f11..fd41b474e 100644
--- a/std/http/io_test.ts
+++ b/std/http/io_test.ts
@@ -51,7 +51,7 @@ test("chunkedBodyReader", async () => {
await dest.write(buf.subarray(0, len));
}
const exp = "aaabbbbbcccccccccccdddddddddddddddddddddd";
- assertEquals(dest.toString(), exp);
+ assertEquals(new TextDecoder().decode(dest.bytes()), exp);
});
test("chunkedBodyReader with trailers", async () => {
@@ -133,7 +133,10 @@ test("writeTrailer", async () => {
new Headers({ "transfer-encoding": "chunked", trailer: "deno,node" }),
new Headers({ deno: "land", node: "js" })
);
- assertEquals(w.toString(), "deno: land\r\nnode: js\r\n\r\n");
+ assertEquals(
+ new TextDecoder().decode(w.bytes()),
+ "deno: land\r\nnode: js\r\n\r\n"
+ );
});
test("writeTrailer should throw", async () => {
@@ -336,7 +339,7 @@ test("writeResponse with trailer", async () => {
body,
trailers: () => new Headers({ deno: "land", node: "js" }),
});
- const ret = w.toString();
+ const ret = new TextDecoder().decode(w.bytes());
const exp = [
"HTTP/1.1 200 OK",
"transfer-encoding: chunked",