Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Nested new call problem #108

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

usualoma
Copy link
Member

fixes #104

Cause of the Problem

This is a bit of a detour, but the cause is that when new Response(options) was called in a nested manner, the options referred to the same object in memory as the parent and child.

So when we did this.#res.headers.delete('content-type') at the following location in hono, all content-types of the parent and child were deleted and the applicatioin/json information was lost.

https://github.com/honojs/hono/blob/main/src/context.ts#L145

If the actual global.Response is passed to option when making a nested new call, the header is cloned in it process, so this problem is fixed.

@yusukebe
Copy link
Member

@usualoma

LGTM! Thanks for the quick fix!

@yusukebe yusukebe merged commit c2db258 into honojs:main Dec 11, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

serveStatic w/ compress middleware issue
2 participants