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

update server definition #352

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

update server definition #352

wants to merge 1 commit into from

Conversation

mathysth
Copy link

Update how the server is defined because it could introduce regressions for some Bun HTTP features.
honojs/hono#2645 (comment)

Comment on lines +187 to +189
const untypedServer = server as unknown as any
untypedServer.ip = server.requestIP(req)
return app.fetch(req, untypedServer)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if regressions will occur, but it is better to pass only ip to env now.

Suggested change
const untypedServer = server as unknown as any
untypedServer.ip = server.requestIP(req)
return app.fetch(req, untypedServer)
const ip = server.requestIP(req)
return app.fetch(req, {ip})

Copy link
Author

Choose a reason for hiding this comment

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

I tried and still have the error that is mentionned
honojs/hono#2645 (comment)
Or maybe we can wait for this issue
honojs/hono#2696

const ip = server.requestIP(req)
return app.fetch(req, {ip})

Comment on lines +69 to +71
const untypedServer = server as unknown as any
untypedServer.ip = server.requestIP(req)
return app.fetch(req, untypedServer);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const untypedServer = server as unknown as any
untypedServer.ip = server.requestIP(req)
return app.fetch(req, untypedServer);
const ip = server.requestIP(req)
return app.fetch(req, {ip})

@NicoPlyley
Copy link
Contributor

@mathysth This has been fixed in 4.4.0. There is now a ConnInfo Helper to get the IP address.

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.

None yet

3 participants