Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ export const handle = (userApp?: Hono, options?: Options) => {
const args = createGetLoadContextArgs(c)

const reactRouterContext = getLoadContext(args)
return handler(
c.req.raw,
reactRouterContext instanceof Promise ? await reactRouterContext : reactRouterContext
)
const resolvedContext = reactRouterContext instanceof Promise ? await reactRouterContext : reactRouterContext

const response = await handler(c.req.raw, resolvedContext)

if (response.headers.get('content-type')?.includes('text/html')) {
response.headers.set('transfer-encoding', 'chunked')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's a good design if we set transfering-encoding: chunked for all HTML responses.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, this fix was quite hasty. Since it doesn't seem to be a straightforward fix, I will log an issue for it at this time.

}

return response
})

return app
Expand Down