NodeIncomingMessage
NodeIncomingMessage is the low-level incoming request interface. It combines Node.js Readable with the core fields of http.IncomingMessage. HttpIncoming extends this interface with higher-level helpers.
import { NodeIncomingMessage } from '@opra/http';
Properties
These properties are picked from Node.js http.IncomingMessage:
| Property | Type | Description |
|---|---|---|
httpVersion | string | HTTP version string, e.g. '1.1'. |
httpVersionMajor | number | Major version number. |
httpVersionMinor | number | Minor version number. |
complete | boolean | true when the message has been fully received. |
headers | IncomingHttpHeaders | Parsed headers object (all names lowercase). |
rawHeaders | string[] | Raw headers as key-value pairs in the order received. |
trailers | Record<string, string | undefined> | Parsed trailing headers. |
rawTrailers | string[] | Raw trailing headers. |
method | string | undefined | HTTP method, e.g. 'GET'. |
url | string | undefined | Request URL including query string. |
Namespace
NodeIncomingMessage.from(iterable)
NodeIncomingMessage.from(
iterable: string | Iterable<any> | AsyncIterable<any> | Initiator
): NodeIncomingMessage
Creates a NodeIncomingMessage synchronously. When iterable is an Initiator object, the properties are applied directly. When it is a string or iterable, it is parsed as a raw HTTP request.
NodeIncomingMessage.fromAsync(iterable)
NodeIncomingMessage.fromAsync(
iterable: string | Iterable<any> | AsyncIterable<any> | Initiator
): Promise<NodeIncomingMessage>
Same as from() but waits until parsing is complete before resolving.
Interfaces
NodeIncomingMessage.Initiator
Used with NodeIncomingMessage.from() to construct a message from a plain object.
| Property | Type | Description |
|---|---|---|
httpVersionMajor | number | undefined | HTTP major version. |
httpVersionMinor | number | undefined | HTTP minor version. |
method | string | undefined | HTTP method. |
url | string | undefined | Request URL. |
headers | Record<string, any> | string[] | undefined | Request headers. |
trailers | Record<string, any> | string[] | undefined | Trailing headers. |
params | Record<string, any> | undefined | Path parameters. |
cookies | Record<string, any> | undefined | Cookie values. |
body | any | Request body. |
ip | string | undefined | Remote IP address. |
ips | string[] | undefined | Proxy chain IP addresses. |