NodeHttpIncomingMessage.ts
NodeHttpIncomingMessage.ts overview
Section titled “NodeHttpIncomingMessage.ts overview”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
Exports Grouped by Category
Section titled “Exports Grouped by Category”constructors
Section titled “constructors”NodeHttpIncomingMessage (class)
Section titled “NodeHttpIncomingMessage (class)”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> )}Since v4.0.0
[IncomingMessage.TypeId] (property)
Section titled “[IncomingMessage.TypeId] (property)”Marks this value as an HTTP incoming message for runtime guards.
Signature
readonly [IncomingMessage.TypeId]: "~effect/http/HttpIncomingMessage"Since v4.0.0
source (property)
Section titled “source (property)”Signature
readonly source: Http.IncomingMessageonError (property)
Section titled “onError (property)”Signature
readonly onError: (error: unknown) => EremoteAddressOverride (property)
Section titled “remoteAddressOverride (property)”Signature
readonly remoteAddressOverride: Option.Option<string> | undefined