When using HonoAdapter, the following error thrown when calling the API with status code 204
TypeError: Response constructor: Invalid response status code 204
at webidl.errors.exception (node:internal/deps/undici/undici:1801:14)
at initializeResponse (node:internal/deps/undici/undici:5919:31)
at new Response (node:internal/deps/undici/undici:5713:9)
at [getResponseCache] (/home/steven/repo/working/lh/bull/node_modules/@hono/node-server/dist/index.js:231:36)
at _Response.get (/home/steven/repo/working/lh/bull/node_modules/@hono/node-server/dist/index.js:271:36)
at Context.newResponse (/home/steven/repo/working/lh/bull/node_modules/hono/dist/cjs/context.js:134:33)
at Context.text (/home/steven/repo/working/lh/bull/node_modules/hono/dist/cjs/context.js:166:45)
at errorHandler (/home/steven/repo/working/lh/bull/node_modules/hono/dist/cjs/hono-base.js:64:12)
at dispatch (/home/steven/repo/working/lh/bull/node_modules/hono/dist/cjs/compose.js:57:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
This is because Hono only accepts an empty body when status code is 204, and the existing API returns an empty json {}.
To solve this problem, adding the following code to HonoAdapter in packages/hono/src/HonoAdapter.ts
When using
HonoAdapter
, the following error thrown when calling the API with status code 204This is because Hono only accepts an empty body when status code is 204, and the existing API returns an empty json
{}
.To solve this problem, adding the following code to
HonoAdapter
inpackages/hono/src/HonoAdapter.ts