DJ
DJ
HHono
Created by DJ on 10/25/2024 in #help
c.req.param() not work when using middleware combine
hi all, I can't get params inside "every" middleware, but it works in "some" middleware. is this a bug? how can i get params inside every?
export const m = (action: string, field: string): MiddlewareHandler =>
every(
createMiddleware<AppContext>(
(c, next) => {
// got empty object here.
console.log(c.req.param())
return next()
}
)
)
export const m = (action: string, field: string): MiddlewareHandler =>
every(
createMiddleware<AppContext>(
(c, next) => {
// got empty object here.
console.log(c.req.param())
return next()
}
)
)
2 replies
HHono
Created by DJ on 10/17/2024 in #help
Is there any way to mock cookies using testing helpers?
we already have testing helper and cookies helpers in Hono, but I can't find a way to inject cookies. I'm using Lucia with Hono together, they recommend to transfer session by cookies. Is this possible in test environment? if no, I have a worst plan is to create a custom app and takeover routes. and replace cookie middleware with bearer token middleware. how do you think?
6 replies