Is there a way to modify the request method in hono middleware? #1089
-
I am implementing the tus protocol and I need to be able to modify the incoming request method. I could just build a switch statement and do routing myself but then it reduces the need for hono. There's probably no way around this. Is there any way to modify the request method in hono middleware? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @spencerbart I think this is not a recommended approach, though, you can try this: app.use('/', async (c, next) => {
const req = c.req.raw.clone()
c.req.raw = new Request(req, {
method: 'POST',
})
await next()
// ...
}) |
Beta Was this translation helpful? Give feedback.
-
@spencerbart did you figure out how to work with tus + hono? I'm assuming you've created a separate implementation from tus-node? |
Beta Was this translation helpful? Give feedback.
Hi @spencerbart
I think this is not a recommended approach, though, you can try this: