Skip to content

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