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:
parent
ef17488398
commit
d146d45861
2 changed files with 8 additions and 2 deletions
|
@ -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(() => {});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue