1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

benchmark: align deno_http and node_http response (#3484)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2019-12-11 21:02:23 -08:00 committed by Ry Dahl
parent ef17488398
commit d146d45861
2 changed files with 8 additions and 2 deletions

View file

@ -7,5 +7,11 @@ const body = new TextEncoder().encode("Hello World");
console.log(`http://${addr}/`);
for await (const req of server) {
req.respond({ body });
const res = {
body,
headers: new Headers()
};
res.headers.set("Date", new Date().toUTCString());
res.headers.set("Connection", "keep-alive");
req.respond(res).catch(() => {});
}

View file

@ -4,6 +4,6 @@ const port = process.argv[2] || "4544";
console.log("port", port);
http
.Server((req, res) => {
res.end("Hello World\n");
res.end("Hello World");
})
.listen(port);