Skip to content

Commit

Permalink
fix(hono): content-type could be removed in middlewares
Browse files Browse the repository at this point in the history
  • Loading branch information
magne4000 committed Aug 22, 2024
1 parent c13e8f5 commit 460d7d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/adapter-hono/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ export function createMiddleware<

if (typeof response === "function") {
await next();
honoContext.res = await response(honoContext.res);
const res = await response(honoContext.res);
if (res) {
return res;
}
} else if (response !== null && typeof response === "object") {
if (response instanceof Response) {
return response;
Expand Down
3 changes: 3 additions & 0 deletions packages/tests/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ export function runTests(runs: Run[], options: Options) {
options.vitest
.expect(response.headers.has("x-should-be-removed"))
.toBe(false);
options.vitest
.expect(response.headers.get("content-type"))
.toBe("application/json; charset=utf-8");
await options?.test?.(response);
},
30_000,
Expand Down

0 comments on commit 460d7d5

Please sign in to comment.