-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameter is Undefined in the next Handler #15
Comments
I think I need more details. Assuming it('test', async () => {
const route = new Hono();
route.get(
'/:id',
openApi({
tags: ['meeting'],
summary: 'Get one meeting',
request: {
param: z.object({
id: z.string(),
}),
},
responses: {
200: z.object({ id: z.string() }),
},
}),
async (c) => {
const param = c.req.valid('param');
const id = param.id;
return c.json({ id }, 200);
},
);
const res = await route.request('/123');
const data = await res.json();
expect(data).toEqual({ id: '123' });
}); How are you calling your API? What is |
Yes, route = new Hono(). I found the issue now. it happens when I use other middleware before using openApi (cors, logger).
|
Okay, I see. I will look into it, this certainly should not happen. |
This problem is related to |
I see. Thank you for your great work. |
Please upgrade the library to 0.5.0 and upgrade Hono to v4.6.10. The fix is included there. |
Sample code:
param is undefined and the request cannot go through the zValidator too.
The text was updated successfully, but these errors were encountered: