Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark: align deno_http and node_http response #3484

Merged
merged 1 commit into from Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion std/http/http_bench.ts
Expand Up @@ -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(() => {});
}
2 changes: 1 addition & 1 deletion tools/node_http.js
Expand Up @@ -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);