Skip to main content

Interface: HttpResponse

Defined in: service-core/src/http/types.ts:44

Framework-agnostic HTTP response interface. Mirrors the Express Response surface used throughout this codebase.

Indexable

[key: string]: any

Allow arbitrary per-response properties.

Properties

headersSent

headersSent: boolean

Defined in: service-core/src/http/types.ts:46


result?

optional result?: any

Defined in: service-core/src/http/types.ts:49

Intermediate result passed between middleware via res.result.


statusCode

statusCode: number

Defined in: service-core/src/http/types.ts:45


writableEnded

writableEnded: boolean

Defined in: service-core/src/http/types.ts:47

Methods

appendHeader()

appendHeader(key, value): this

Defined in: service-core/src/http/types.ts:57

Adds a value for a header without clobbering any value(s) already set for the same key — the header is sent as multiple lines on the wire (e.g. multiple Set-Cookie headers).

Parameters

key

string

value

string | number

Returns

this


end()

end(data?): void

Defined in: service-core/src/http/types.ts:61

Parameters

data?

any

Returns

void


getHeader()

getHeader(key): string | string[] | undefined

Defined in: service-core/src/http/types.ts:58

Parameters

key

string

Returns

string | string[] | undefined


json()

json(data): void

Defined in: service-core/src/http/types.ts:59

Parameters

data

any

Returns

void


onFinish()

onFinish(handler): void

Defined in: service-core/src/http/types.ts:67

Registers a callback fired exactly once when the response actually completes — either a normal end() or client/stream abort. Does not delay or await end(). Used to persist request-scoped state (e.g. session data) after downstream handlers finish mutating it.

Parameters

handler

() => void | Promise<void>

Returns

void


send()

send(data?): void

Defined in: service-core/src/http/types.ts:60

Parameters

data?

any

Returns

void


setHeader()

setHeader(key, value): this

Defined in: service-core/src/http/types.ts:52

Sets a header, replacing any value(s) previously set for the same key.

Parameters

key

string

value

string | number | string[]

Returns

this


status()

status(code): this

Defined in: service-core/src/http/types.ts:50

Parameters

code

number

Returns

this