hono: Weird 500 error during routing
What version of Hono are you using?
3.7.2
What runtime/platform is your app running on?
Node
What steps can reproduce the bug?
import { Hono } from 'hono';
import {serve} from "@hono/node-server";
const app = new Hono();
app.get('/:url{.*}', async (ctx) => {
// I want receive ctx.req.param('url');
return ctx.html("ok");
});
serve(app);
What is the expected behavior?
I want receive ctx.req.param('url')
without problems for any requested path.
What do you see instead?
Absolutely empty 500 error
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 15 (4 by maintainers)
@rajput-hemant
This https://github.com/honojs/hono/issues/1513#issuecomment-1738890316 is a bug! and fixed it in this PR: #1522 Thanks!
You’re welcome!
@vanodevium,
We can always use null assertion for the default value
For example:
This way, if
ctx.req.param('url')
returnsundefined
, it will use'default'
as the default value.