Skip to content

Comments

Add HTTP/1.1 handler support to Node.js endpoint#643

Open
nikrooz wants to merge 4 commits intomainfrom
NN_support-h1-node
Open

Add HTTP/1.1 handler support to Node.js endpoint#643
nikrooz wants to merge 4 commits intomainfrom
NN_support-h1-node

Conversation

@nikrooz
Copy link
Contributor

@nikrooz nikrooz commented Feb 12, 2026

Some Node.js frameworks and libraries only accept HTTP/1.1 request listeners, so integrating Restate with them means going through the fetch handler and converting it back to a Node listener.

This isn't strictly needed, that conversion works fin, but having a native HTTP/1.1 handler makes those integrations a bit more straightforward. Totally fine if we prefer not to expand the API surface.

  • Add http1Handler() and handler() methods to RestateEndpoint, alongside the existing http2Handler().
  • http1Handler() returns a handler typed for http.createServer(). It defaults to REQUEST_RESPONSE protocol mode; pass { bidirectional: true } to use BIDI_STREAM.
  • handler() returns an overloaded callable that auto-detects HTTP version per request: HTTP/2+ uses BIDI_STREAM, HTTP/1.1 uses REQUEST_RESPONSE by default. The bidirectional option is tri-state: true forces BIDI_STREAM for all, false forces REQUEST_RESPONSE for all, undefined auto-detects.
  • createEndpointHandler() now returns the unified handler(), accepting a new NodeEndpointOptions type with the bidirectional option.
  • Internally, the handler is split into nodeHttp1Handler / nodeHttp2Handler typed wrappers over a shared nodeHandlerImpl, separating HTTP transport types from protocol mode.
  • Add HTTP/1.1 example (greeter_http1.ts) and integration tests covering both request-response and bidirectional modes using testcontainers with use_http_11: true.

Signed-off-by: Nik Nasr <nik@restate.dev>
Signed-off-by: Nik Nasr <nik@restate.dev>
Signed-off-by: Nik Nasr <nik@restate.dev>
Signed-off-by: Nik Nasr <nik@restate.dev>
@github-actions
Copy link

Test Results

  7 files  ±0    7 suites  ±0   3m 21s ⏱️ +16s
 49 tests ±0   49 ✅ ±0  0 💤 ±0  0 ❌ ±0 
210 runs  ±0  210 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 887fa32. ± Comparison against base commit e292abc.

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.

1 participant