Ambuj Kumar
Ambuj Kumar
I experienced the same, You shoud try using `c.res.headers.set('Content-Type', 'text/css')` instead in the meantime.
I think the condition is when you create and use a custom middleware function,which returns a closure of (c, next): Handler function type. Somehow the global c.headers method gets disconnected...
That kind of narrows down the problem ```ts // This works c.res.headers.set('content-type', 'text/css') // But this does not c.headers('content-type', 'text/css') ``` I think you should look into something that is...
Try that in a custom middleware. It works fine in get, post, and use, etc.
No, like this : ```ts // some-middlware.ts export function middleware() { return (c, next) => { c.headers(k, v) } } ``` import this in index.ts and use ```ts app.use('*', middleware())...
Also, when I used await next() to set content type in serve static middle, it worked but could not set or send response body, because it was already sent.
Try setting a body in the middleware after setting headers. I'll reproduce the bug when I'm on my laptop. Although my serve static middleware might be written wrong but that...
I think, I figured it out. It is not reproducible after around 2.1.4. I checked my lock file before merging from upstream to my fork, I was on version v2.1.4....
I'm sorry for making assumptions about your code. I should carefully read the code I am copying from.
I think that is the case. No one noticed because there isn't much usage of bun js with hono. As @yusukebe mentioned, it was a fix he forgot to do...