H
HonoKorny

Case insensitive query params

We are using hono-zod-openapi to replace an existing API. Sadly the old API (written in ASP.Net) appears to have case-insensitive handling of parameters - and we may need to emulate this. Gah. So we have something like
const myParams = z.object({
FooBar: z.string().openapi({...})
});
const route = createRoute({
method: 'get',
path: '/blah',
request:{
query: myParams,
const myParams = z.object({
FooBar: z.string().openapi({...})
});
const route = createRoute({
method: 'get',
path: '/blah',
request:{
query: myParams,
But I need to support GET /blah?fooBar= and all other variants of FooBar and foobar etc. Any ideas? I guess worst case we could add some middleware to downcase all parameters or something.
Nico
Nico31d ago
I’m not sure if there is a special way to do it. I would just convert everything to lowercase like you mentioned. I always do it myself as well