summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2022-09-04 18:29:38 +0530
committerGitHub <noreply@github.com>2022-09-04 18:29:38 +0530
commit50fc5d169aec43b4cc0c4ff08a8073bca99c18f4 (patch)
tree8af22fe7b560ddb7a16b269e644629e2a3891231
parente324151520c62c9503e5e38da66827cd7815ea14 (diff)
fix(bench): make sure bytes/response is equal (#15763)
-rw-r--r--cli/bench/http/bun_hono_router.js4
-rw-r--r--cli/bench/http/bun_http.js4
-rw-r--r--cli/bench/http/bun_http_send_file.js4
3 files changed, 10 insertions, 2 deletions
diff --git a/cli/bench/http/bun_hono_router.js b/cli/bench/http/bun_hono_router.js
index a0bba67d5..38f9c3542 100644
--- a/cli/bench/http/bun_hono_router.js
+++ b/cli/bench/http/bun_hono_router.js
@@ -3,6 +3,10 @@ const port = Bun.argv[2] || "4545";
const { Hono } = require("../testdata/npm/hono/dist/index.js");
const app = new Hono();
+app.use("*", async (c, n) => {
+ c.res.headers.set("Date", (new Date()).toUTCString());
+ await n();
+});
app.get("/", (c) => c.text("Hello, World!"));
Bun.serve({
diff --git a/cli/bench/http/bun_http.js b/cli/bench/http/bun_http.js
index a4cd2c562..89ff9b121 100644
--- a/cli/bench/http/bun_http.js
+++ b/cli/bench/http/bun_http.js
@@ -2,7 +2,9 @@
const port = Bun.argv[2] || "4545";
Bun.serve({
fetch(_req) {
- return new Response("Hello World");
+ return new Response("Hello World", {
+ headers: { "Date": (new Date()).toUTCString() },
+ });
},
port: Number(port),
});
diff --git a/cli/bench/http/bun_http_send_file.js b/cli/bench/http/bun_http_send_file.js
index 615c35d31..268da9ae9 100644
--- a/cli/bench/http/bun_http_send_file.js
+++ b/cli/bench/http/bun_http_send_file.js
@@ -6,7 +6,9 @@ const path = new URL("../testdata/128k.bin", import.meta.url).pathname;
Bun.serve({
fetch(_req) {
const file = Bun.file(path);
- return new Response(file);
+ return new Response(file, {
+ headers: { "Date": (new Date()).toUTCString() },
+ });
},
port: Number(port),
});