c.json()
etc. throwing type error when the status is contentless code, e.g., 204
From this release, when c.json()
, c.text()
, or c.html()
returns content, specifying a contentless status code such as 204 will now throw a type error.
At first glance, this seems like a breaking change but not. It is not possible to return a contentless response with c.json()
or c.text()
. So, in that case, please use c.body()
.
app.get('/', (c) => {
return c.body(null, 204)
})
What's Changed
- fix(jsr): exclude unused markdown files by @ryuapp in #3767
- feat(hono/context): contentful status code typing by @askorupskyy in #3763
- refactor(context): remove lint errors by @yusukebe in #3769
- feat(context):
ResponseInit
accepts genericsStatusCode
forstatus
by @yusukebe in #3770 - feat(utils/cookie): Ability to set a priority to cookies in setCookie options by @Beyondo in #3762
- fix(hono-base): don't use Symbol for
COMPOSED_HANDLER
by @yusukebe in #3773
New Contributors
- @askorupskyy made their first contribution in #3763
- @Beyondo made their first contribution in #3762
Full Changelog: v4.6.14...v4.6.15