Skip to content

NodeHttpIncomingMessage.ts

Adapter base for exposing Node http.IncomingMessage values as Effect HTTP incoming messages.

Server requests and Node client responses both arrive as Node readable streams with raw header objects, socket metadata, and one-shot body consumption. This module’s NodeHttpIncomingMessage class keeps the original Node message available while presenting Effect’s HttpIncomingMessage shape: typed headers, remote address lookup, stream access, and text, JSON, URL-encoded, and array-buffer body readers.

Since v4.0.0



Adapts a Node IncomingMessage to Effect HTTP incoming messages.

When to use

Use to implement Node HTTP request or response adapters that expose the Effect HTTP incoming-message interface.

Details

The adapter exposes headers, remote address, stream access, and cached body decoders. Subclasses provide the error mapping for unknown Node errors.

Signature

declare class NodeHttpIncomingMessage<E> {
constructor(
source: Http.IncomingMessage,
onError: (error: unknown) => E,
remoteAddressOverride?: Option.Option<string>
)
}

Source

Since v4.0.0

Marks this value as an HTTP incoming message for runtime guards.

Signature

readonly [IncomingMessage.TypeId]: "~effect/http/HttpIncomingMessage"

Source

Since v4.0.0

Signature

readonly source: Http.IncomingMessage

Source

Signature

readonly onError: (error: unknown) => E

Source

Signature

readonly remoteAddressOverride: Option.Option<string> | undefined

Source