summaryrefslogtreecommitdiff
path: root/std/http/server_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/http/server_test.ts')
-rw-r--r--std/http/server_test.ts38
1 files changed, 19 insertions, 19 deletions
diff --git a/std/http/server_test.ts b/std/http/server_test.ts
index f66b190b2..d6b2be053 100644
--- a/std/http/server_test.ts
+++ b/std/http/server_test.ts
@@ -11,7 +11,7 @@ import {
assertEquals,
assertNotEOF,
assertStrContains,
- assertThrowsAsync
+ assertThrowsAsync,
} from "../testing/asserts.ts";
import { Response, ServerRequest, Server, serve } from "./server.ts";
import { BufReader, BufWriter } from "../io/bufio.ts";
@@ -30,27 +30,27 @@ const responseTests: ResponseTest[] = [
// Default response
{
response: {},
- raw: "HTTP/1.1 200 OK\r\n" + "content-length: 0" + "\r\n\r\n"
+ raw: "HTTP/1.1 200 OK\r\n" + "content-length: 0" + "\r\n\r\n",
},
// Empty body with status
{
response: {
- status: 404
+ status: 404,
},
- raw: "HTTP/1.1 404 Not Found\r\n" + "content-length: 0" + "\r\n\r\n"
+ raw: "HTTP/1.1 404 Not Found\r\n" + "content-length: 0" + "\r\n\r\n",
},
// HTTP/1.1, chunked coding; empty trailer; close
{
response: {
status: 200,
- body: new Buffer(new TextEncoder().encode("abcdef"))
+ body: new Buffer(new TextEncoder().encode("abcdef")),
},
raw:
"HTTP/1.1 200 OK\r\n" +
"transfer-encoding: chunked\r\n\r\n" +
- "6\r\nabcdef\r\n0\r\n\r\n"
- }
+ "6\r\nabcdef\r\n0\r\n\r\n",
+ },
];
test(async function responseWrite(): Promise<void> {
@@ -118,7 +118,7 @@ function totalReader(r: Deno.Reader): TotalReader {
read,
get total(): number {
return _total;
- }
+ },
};
}
test(async function requestBodyWithContentLength(): Promise<void> {
@@ -169,7 +169,7 @@ test("ServerRequest.finalize() should consume unread body / chunked, trailers",
"deno: land",
"node: js",
"",
- ""
+ "",
].join("\r\n");
const req = new ServerRequest();
req.headers = new Headers();
@@ -357,7 +357,7 @@ test({
// Runs a simple server as another process
const p = Deno.run({
cmd: [Deno.execPath(), "--allow-net", "http/testdata/simple_server.ts"],
- stdout: "piped"
+ stdout: "piped",
});
let serverIsRunning = true;
@@ -387,7 +387,7 @@ test({
p.stdout!.close();
p.close();
}
- }
+ },
});
test({
@@ -401,9 +401,9 @@ test({
Deno.execPath(),
"--allow-net",
"--allow-read",
- "http/testdata/simple_https_server.ts"
+ "http/testdata/simple_https_server.ts",
],
- stdout: "piped"
+ stdout: "piped",
});
let serverIsRunning = true;
@@ -425,7 +425,7 @@ test({
const conn = await Deno.connectTLS({
hostname: "localhost",
port: 4503,
- certFile: "http/testdata/tls/RootCA.pem"
+ certFile: "http/testdata/tls/RootCA.pem",
});
await Deno.writeAll(
conn,
@@ -444,7 +444,7 @@ test({
p.stdout!.close();
p.close();
}
- }
+ },
});
test("close server while iterating", async (): Promise<void> => {
@@ -485,7 +485,7 @@ test({
const resources = Deno.resources();
assertEquals(resources[conn.rid], "tcpStream");
conn.close();
- }
+ },
});
test({
@@ -498,7 +498,7 @@ test({
await assertThrowsAsync(async () => {
await req.respond({
status: 12345,
- body: new TextEncoder().encode("Hello World")
+ body: new TextEncoder().encode("Hello World"),
});
}, Deno.errors.InvalidData);
// The connection should be destroyed
@@ -509,7 +509,7 @@ test({
const p = serverRoutine();
const conn = await Deno.connect({
hostname: "127.0.0.1",
- port: 8124
+ port: 8124,
});
await Deno.writeAll(
conn,
@@ -517,5 +517,5 @@ test({
);
conn.close();
await p;
- }
+ },
});