Skip to content

Error c.res.status of 404 in middlewareHandler before next() #3788

Closed
@seepine

Description

What version of Hono are you using?

4.6.14

What runtime/platform is your app running on? (with version if possible)

bun

What steps can reproduce the bug?

app.use(async (c, next) => {
    console.log('before', c.res.status);
    await next()
    console.log('after', c.res.status);
})
app.get('/test', ...)

What is the expected behavior?

Try curl

$ curl 127.0.0.1:3000/test
before 200    // It is possible to know whether the route exists.  
after 200

$ curl 127.0.0.1:3000/test2
before 404
after 404

What do you see instead?

Try curl

$ curl 127.0.0.1:3000/test
before 404
after 200

$ curl 127.0.0.1:3000/test2
before 404
after 404

Additional information

No response

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions