summaryrefslogtreecommitdiff
path: root/std/http
diff options
context:
space:
mode:
Diffstat (limited to 'std/http')
-rw-r--r--std/http/io_test.ts9
-rw-r--r--std/http/server_test.ts2
2 files changed, 7 insertions, 4 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",
diff --git a/std/http/server_test.ts b/std/http/server_test.ts
index 4e7b4b69e..03256dd25 100644
--- a/std/http/server_test.ts
+++ b/std/http/server_test.ts
@@ -63,7 +63,7 @@ test("responseWrite", async function (): Promise<void> {
request.conn = mockConn();
await request.respond(testCase.response);
- assertEquals(buf.toString(), testCase.raw);
+ assertEquals(new TextDecoder().decode(buf.bytes()), testCase.raw);
await request.done;
}
});