Packages

hono

4.13.19 · 16 Nov 2026MIT114.5M / weekRepositoryHomepagenpmAtom feed

Your version

4.2.0

2 Apr 2024Where it was published

4.13.19 is the newest release of 4.x.

In short

41 new2 changed2 internal

Security

48 advisories affect 4.2.0; 4.13.16 fixes them

43 more

Release note

Hono v4.2.0 is now available! Let's take a look at the new features.

Added more algorithms for JWT

The number of algorithms that JWT util can handle has increased from only 3 to 13! This means that JWT util now implements many of the algorithms supported by JWT.

  • HS256

  • HS384

  • HS512

  • RS256

  • RS384

  • RS512

  • PS256

  • PS384

  • PS512

  • ES256

  • ES384

  • ES512

  • EdDSA

You can use these algorithms from the JWT middleware or JWT helpers. Thanks @Code-Hex!

Method Override Middleware

Method Override Middleware has been added. This middleware override the method of the real request with the specified method.

HTML form does not allow you to send a DELETE method request. Instead, by sending an input with name as _method and a value of DELETE, you can call the handler registered in app.delete().

const app = new Hono()

// If no options are specified, the value of `_method` in the form,
// e.g. DELETE, is used as the method.
app.use('/posts', methodOverride({ app }))

app.delete('/posts', (c) => {
  // ....
})

Trailing Slash Middleware

Trailing Slash Middleware resolves the handling of Trailing Slashes in GET requests. You can use appendTrailingSlash and trimTrailingSlash functions.

For example, it redirects a GET request to /about/me to /about/me/.

import { Hono } from 'hono'
import { appendTrailingSlash } from 'hono/trailing-slash'

const app = new Hono({ strict: true })

app.use(appendTrailingSlash())
app.get('/about/me/', (c) => c.text('With Trailing Slash'))

Thanks @rnmeow!

Other features

  • SSG Helper - Support extensionMap #2382

  • JSX/DOM - Add userId hook #2389

  • JWT Middleware - Improve error handling #2406

  • Request - Cache the body for re-using #2416

  • JWT Util - Add type helper to payload #2424

  • CORS Middleware - Pass context to options.origin function #2436

  • Cache Middleware - Support for the vary header option #2426

  • HTTP Exception - Add cause option #2224

  • Logger - Support NO_COLOR #2228

  • JWT Middleware - Add JwtTokenInvalid object as cause when JWT is invalid #2448

  • Bearer Auth Middleware - Add verifyToken option #2449

  • Basic Auth Middleware - Add verifyUser option #2450

All Updates

  • jwt: Supported RS256, RS384, RS512 algorithm for JWT

  • Added remain algorithm for JWT

  • Acceptable CryptoKey in JWT sign and verify

  • ssg: Support extentionMap

  • jwt: Support remaining algorithms

  • jsx: Add useId hook

  • middleware/jwt: Improve error handling

  • request: Cache body for reusing

  • jwt: Add type helper to payload

  • Introduce Method Override Middleware

  • middleware/cors: Pass context to options.origin function

  • Support for vary header in cache middleware

  • Add middlewares resolve trailing slashes on GET request

  • jwt: Literal typed alg option value

  • jwt: Add JwtTokenInvalid object as cause when JWT is invalid

  • bearer-auth: Add verifyToken option

  • basic-auth: Add verifyUser option

  • Next

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.