Skip to content

Taxum / @taxum/core / http / HttpResponse

Class: HttpResponse

Defined in: http/response.ts:21

Represents an HTTP response.

See Ownership and Reuse Contract in the module documentation.

Constructors

Constructor

new HttpResponse(status, headers, body, extensions?): HttpResponse

Defined in: http/response.ts:30

Creates a new HttpResponse.

Parameters

status

StatusCode

headers

HeaderMap

body

Body

extensions?

Extensions

Returns

HttpResponse

Properties

body

body: Body

Defined in: http/response.ts:24


extensions

extensions: Extensions

Defined in: http/response.ts:25


headers

headers: HeaderMap

Defined in: http/response.ts:23


status

status: StatusCode

Defined in: http/response.ts:22

Methods

toJSON()

toJSON(): Record<string, unknown>

Defined in: http/response.ts:122

Returns

Record<string, unknown>


write()

write(res): Promise<void>

Defined in: http/response.ts:104

Writes the response data, including headers and body, to the provided ServerResponse.

Parameters

res

ServerResponse

Returns

Promise<void>


builder()

static builder(): HttpResponseBuilder

Defined in: http/response.ts:96

Creates a new HttpResponseBuilder.

Returns

HttpResponseBuilder


from()

static from(response): HttpResponse

Defined in: http/response.ts:45

Creates a new HttpResponse from a HttpResponseLike value.

Parameters

response

HttpResponseLike

Returns

HttpResponse