Skip to content

v4.6.15

Latest
Compare
Choose a tag to compare
@yusukebe yusukebe released this 28 Dec 07:57

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.

CleanShot 2024-12-28 at 16 47 39@2x

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 generics StatusCode for status 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

Full Changelog: v4.6.14...v4.6.15