Skip to main content

Interface: HttpResponse

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

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:79


result?​

optional result?: any

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

Intermediate result passed between middleware via res.result.


statusCode​

statusCode: number

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


writableEnded​

writableEnded: boolean

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

Methods​

appendHeader()​

appendHeader(key, value): this

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

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:94

Parameters​

data?​

any

Returns​

void


getHeader()​

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

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

Parameters​

key​

string

Returns​

string | string[] | undefined


json()​

json(data): void

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

Parameters​

data​

any

Returns​

void


onFinish()​

onFinish(handler): void

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

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:93

Parameters​

data?​

any

Returns​

void


setHeader()​

setHeader(key, value): this

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

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:83

Parameters​

code​

number

Returns​

this