From f98cc1cad466088227d4b592c14f945f30e63e64 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sun, 4 Sep 2022 18:29:38 +0530 Subject: [PATCH] fix(bench): make sure bytes/response is equal (#15763) --- cli/bench/http/bun_hono_router.js | 4 ++++ cli/bench/http/bun_http.js | 4 +++- cli/bench/http/bun_http_send_file.js | 4 +++- 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 a0bba67d53..38f9c35423 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 a4cd2c5620..89ff9b1211 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 615c35d31a..268da9ae96 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), });