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

feat: Forward Raw IncomingMessage and ServerResponse Via Env #129

Merged
merged 4 commits into from
Jan 27, 2024
Merged

feat: Forward Raw IncomingMessage and ServerResponse Via Env #129

merged 4 commits into from
Jan 27, 2024

Conversation

beeequeue
Copy link
Contributor

Makes the raw IncomingMessage and ServerResponse instances accessible via c.env the same way that hono/aws-lambda does it.

After implementing it I saw that #90 does the same thing, but I thought I may as well submit it as it is smaller in scope.

type Bindings = {
  incoming: IncomingMessage
  outgoing: ServerResponse
}

const app = new Hono<{ Bindings: Bindings}>()

app.get('/', (c) => {
  console.log(c.env.incoming.url)
})

Related: #80 #90 #122

@yusukebe
Copy link
Member

@beeequeue

Coool! I'll check it later.

@yusukebe
Copy link
Member

@beeequeue

Looks great!

One thing, we could export the following Bindings types.

export type Bindings = {
  incoming: IncomingMessage
  outgoing: ServerResponse
}

I think users should import from @hono/node-server.

import type { Bindings } from '@hono/node-server'

cc: @Kyiro What do you think about this PR though I think you will say OK.

- create and export `HttpBindings` and `Http2Bindings`
- make `FetchCallback` not depend on `hono`
@Kyiro
Copy link

Kyiro commented Jan 26, 2024

looks good to me

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

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

Looks great!

@yusukebe yusukebe changed the title Forward Raw IncomingMessage and ServerResponse Via Env feat: Forward Raw IncomingMessage and ServerResponse Via Env Jan 27, 2024
@yusukebe
Copy link
Member

@beeequeue

I'll merge this now. Thanks!

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.

3 participants