Skip to content

Taxum / @taxum/core / http / HttpRequest

Class: HttpRequest

Defined in: http/request.ts:90

Represents an HTTP request, encapsulating the request's headers, body, and associated metadata such as the HTTP method, URI, and version.

Constructors

Constructor

new HttpRequest(head, body, connectInfo?): HttpRequest

Defined in: http/request.ts:98

Creates a new HttpRequest.

Parameters

Parts

body

Body

connectInfo?

SocketAddress

Returns

HttpRequest

Properties

body

readonly body: Body

Defined in: http/request.ts:92


connectInfo

readonly connectInfo: SocketAddress

Defined in: http/request.ts:93


head

readonly head: Parts

Defined in: http/request.ts:91

Accessors

extensions

Get Signature

get extensions(): Extensions

Defined in: http/request.ts:165

Returns

Extensions


headers

Get Signature

get headers(): HeaderMap

Defined in: http/request.ts:161

Returns

HeaderMap


method

Get Signature

get method(): Method

Defined in: http/request.ts:149

Returns

Method


uri

Get Signature

get uri(): URL

Defined in: http/request.ts:153

Returns

URL


version

Get Signature

get version(): string

Defined in: http/request.ts:157

Returns

string

Methods

toJSON()

toJSON(): Record<string, unknown>

Defined in: http/request.ts:169

Returns

Record<string, unknown>


withBody()

withBody(body): HttpRequest

Defined in: http/request.ts:138

Creates a new HttpRequest with the provided body.

Parameters

body

Body

Returns

HttpRequest


withUri()

withUri(uri): HttpRequest

Defined in: http/request.ts:145

Creates a new HttpRequest with the provided URI.

Parameters

uri

URL

Returns

HttpRequest


builder()

static builder(): HttpRequestBuilder

Defined in: http/request.ts:112

Creates a new HttpRequestBuilder.

Returns

HttpRequestBuilder


fromIncomingMessage()

static fromIncomingMessage(message, trustProxy): HttpRequest

Defined in: http/request.ts:122

Creates a new HttpRequest from the provided IncomingMessage.

Parameters

message

IncomingMessage

trustProxy

boolean

Returns

HttpRequest

See

Parts.fromIncomingMessage for more information about the trustProxy parameter.