Packages

hono

4.13.19 · 16 Nov 2026MIT113.6M / weekRepositoryHomepagenpmAtom feed

Your version

3.5.0

21 Aug 2023Where it was published

3.12.12 is the newest release of 3.x.

In short

4 deprecated10 new6 fixed1 changed6 internal

  • Deprecated

    queries in the Validator - Please switch to query.

  • Deprecated

    c.runtime() - Transition to the Adapter Helper.

  • Deprecated

    app.handleEvent() - Use app.fetch() instead.

  • Deprecated

    validator: Deprecate queries (use query instead)

Security

44 advisories affect 3.5.0; 4.13.16 fixes them

39 more

Release note

Release Notes

Hono v3.5.0 is now available! Here's what's new.

Secure Headers Middleware

We've added the Secure Headers Middleware. It aids in enhancing your app's security by setting HTTP response headers. It's akin to Helmet for Express.

import { Hono } from 'hono'
import { secureHeaders } from 'hono/secure-headers'

const app = new Hono()

app.use('*', secureHeaders())

app.get('/', (c) => c.text('Hello!'))

// ...

export default app

For an in-depth look, visit the documentation. Thanks @watany-dev for the remarkable contribution!

Introducing "Helpers"

We're unveiling a new concept named "Helpers". While similar to middleware, these are not handlers but handy functions. Prior to this release, the cookie-related functions were a part of the Cookie Middleware. These aren't true middleware. Now, they've been transformed into the "Cookie Helper":

import { getCookie, setCookie } from 'hono/cookie'

const app = new Hono()

app.get('/cookie', (c) => {
  const yummyCookie = getCookie(c, 'yummy_cookie')
  // ...
  setCookie(c, 'delicious_cookie', 'macha')
  // ...
})

However, no worries about breaking changes! The import path hono/cookie remains unchanged. So, usage remains consistent with previous versions.

Zod OpenAPI Middleware

Zod OpenAPI has been rolled out. Zod OpenAPI Hono is an enhanced Hono class supporting OpenAPI. It enables value and type validation using Zod and also facilitates OpenAPI Swagger documentation generation.

Dive deeper with the documentation.

Deprecated Features

The following features are now marked as deprecated:

  • Deprecated

    queries in the Validator - Please switch to query.

  • Deprecated

    c.runtime() - Transition to the Adapter Helper.

  • Deprecated

    app.handleEvent() - Use app.fetch() instead.

These will be removed in version 4.

Additional Features

  • The Validator now has the capability to validate "headers" and "cookies". #1352

  • You can now pass env to getPath(). #1345

  • Body content caching is introduced. #1333

  • hono/context has been exported. #1332

All Updates

  • Web query undefined check

  • package.json: Export hono/context

  • req: Cache body content

  • middleware: Signed cookie misinterpretation of cookie values with dot

  • req: Fix inferring types in req.valid()

  • Deprecated

    validator: Deprecate queries (use query instead)

  • validator: Supports header and cookie

  • type: Add missing S to RemoveBlankRecord

  • app: Pass env to getPath()

  • client: Ignore header and cookie types

  • types: Corrected argument types for Context methods

  • middleware: Alternative middleware equivalent to Helmet

  • Introduce "Helpers"

  • middleware.ts: Export secure-headers for Deno

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.