Packages

hono

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

Your version

3.7.0

21 Sep 2023Where it was published

3.12.12 is the newest release of 3.x.

In short

5 new4 fixed2 changed1 internal

Security

44 advisories affect 3.7.0; 4.13.16 fixes them

39 more

Release note

Hono v3.7.0 is out now! Let's take a look at the new features.

c.stream() and c.streamText()

We added the awaited functionality related to streaming. c.stream() and c.streamText().

You can easily create HTTP Streaming endpoints with them.

app.get('/', (c) => {
  return c.streamText(async (stream) => {
    stream.writeln('Hello!')
    await stream.sleep(1000)
    stream.writeln('Hono!')
  })
})

You know Streaming works well with AI. With streamText() you can write your ChatGPT Gateway in elegant code.

app.post('/api', async (c) => {
  const body = await c.req.json<{ message: string }>()

  const openai = new OpenAI({ apiKey: c.env.OPENAI_API_KEY })
  const chatStream = await openai.chat.completions.create({
    messages: PROMPT(body.message),
    model: 'gpt-3.5-turbo',
    stream: true
  })

  return c.streamText(async (stream) => {
    for await (const message of chatStream) {
      await stream.write(message.choices[0]?.delta.content ?? '')
    }
  })
})

This application can display streamed data from OpenAI's API in a flowing manner.

github.com/honojs/hono/assets/10682/cd40a23f-b7…

Thanks, @sor4chi and @geelen !

Testing Helper

With testClient in Testing Helper you can easily write your tests. The object returned by this function is the hc client, so you can define your request with the editor completion.

import { testClient } from 'hono/testing'

it('test', async() => {
  const app = new Hono().get('/search', (c) => c.jsonT({ hello: 'world' }))
  const res = await testClient(app).search.$get()

  expect(await res.json()).toEqual({ hello: 'world' })
})

github.com/honojs/hono/assets/10682/40876984-2c…

Thanks, @hagishi !

JWT helper

We uses JWT functions internally, but now they are exported as JWT Helper. You can import and use them.

import { decode, sign, verify } from 'hono/jwt'

Thanks, @julianpoma !

All Updates

  • Improvement of Parse Body

  • Refactor ClientRequest Type for header validation

  • Expose the Jwt fucntions under the 'hono/jwt' path

  • Add Hono test client (RPC)

  • Add devcontainer to improve developer experience

  • Error to retrieve cookie

  • feat(client) add cookie type validate

  • jwt: Avoid using enum

  • context: Fix c.stream() and c.streamText() matters

  • jwt: Incorrect error message

  • 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.