Class: UWSResponse
Defined in: service-core/src/http/uWS/Adapters.ts:162
Adapts a uWS HttpResponse to the framework-agnostic HttpResponse interface.
Buffers headers and status code until the first write. Tracks abort state to safely
skip writes on aborted connections. All uWS writes are wrapped in res.cork() for
optimal performance.
Implements
Indexable
[
key:string]:any
Allow arbitrary per-response properties.
Constructors
Constructor
new UWSResponse(
uwsRes):UWSResponse
Defined in: service-core/src/http/uWS/Adapters.ts:186
Parameters
uwsRes
HttpResponse
Returns
UWSResponse
Properties
isHead
isHead:
boolean=false
Defined in: service-core/src/http/uWS/Adapters.ts:174
Set to true for HEAD requests — body bytes must not be sent.
result?
optionalresult?:any
Defined in: service-core/src/http/uWS/Adapters.ts:176
Intermediate result passed between middleware.
Implementation of
Accessors
headersSent
Get Signature
get headersSent():
boolean
Defined in: service-core/src/http/uWS/Adapters.ts:212
Returns
boolean
Implementation of
statusCode
Get Signature
get statusCode():
number
Defined in: service-core/src/http/uWS/Adapters.ts:208
Returns
number
Implementation of
writableEnded
Get Signature
get writableEnded():
boolean
Defined in: service-core/src/http/uWS/Adapters.ts:216
Returns
boolean
Implementation of
Methods
appendHeader()
appendHeader(
key,value):this
Defined in: service-core/src/http/uWS/Adapters.ts:230
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
Implementation of
attachBodyStream()
attachBodyStream(
stream):void
Defined in: service-core/src/http/uWS/Adapters.ts:204
Associates this response with a streaming-body route's req.bodyStream, so end() can detect
a response finalizing before uWS has received the whole declared request body and force the
connection closed instead of hanging it — see isBodyStreamFullyReceived()'s doc comment for
the full rationale. Called once, by the router, right after makeBodyStream() creates the
stream (HttpRouteOptions.streamingBody routes only — never called otherwise).
Parameters
stream
Readable
Returns
void
end()
end(
data?):void
Defined in: service-core/src/http/uWS/Adapters.ts:262
Parameters
data?
any
Returns
void
Implementation of
flushHeaders()
flushHeaders():
void
Defined in: service-core/src/http/uWS/Adapters.ts:318
Flushes status and headers to the wire immediately without ending the response. Required before streaming data (e.g. SSE). Safe to call multiple times — only acts on the first call.
Returns
void
getHeader()
getHeader(
key):string|string[] |undefined
Defined in: service-core/src/http/uWS/Adapters.ts:243
Parameters
key
string
Returns
string | string[] | undefined
Implementation of
json()
json(
data):void
Defined in: service-core/src/http/uWS/Adapters.ts:247
Parameters
data
any
Returns
void
Implementation of
onAbort()
onAbort(
callback):void
Defined in: service-core/src/http/uWS/Adapters.ts:360
Registers a callback to run when the client aborts the connection.
Safe to call multiple times — all registered callbacks are invoked on abort.
Uses the single uWS onAborted slot registered in the constructor.
Parameters
callback
() => void
Returns
void
onFinish()
onFinish(
handler):void
Defined in: service-core/src/http/uWS/Adapters.ts:370
Registers a callback fired exactly once when the response lifecycle ends — either a normal end() or a client abort. Fires immediately if the response has already finished. Handlers run fire-and-forget (via a resolved microtask) so slow/async work (e.g. a Redis write) never delays or blocks the actual response flush.
Parameters
handler
() => void | Promise<void>
Returns
void
Implementation of
send()
send(
data?):void
Defined in: service-core/src/http/uWS/Adapters.ts:252
Parameters
data?
any
Returns
void
Implementation of
setHeader()
setHeader(
key,value):this
Defined in: service-core/src/http/uWS/Adapters.ts:225
Sets a header, replacing any value(s) previously set for the same key.
Parameters
key
string
value
string | number | string[]
Returns
this
Implementation of
status()
status(
code):this
Defined in: service-core/src/http/uWS/Adapters.ts:220
Parameters
code
number
Returns
this
Implementation of
write()
write(
data):void
Defined in: service-core/src/http/uWS/Adapters.ts:349
Writes a chunk to the response without ending it (streaming / SSE). Flushes headers on the first call if they haven't been sent yet.
Parameters
data
string | Buffer<ArrayBufferLike>
Returns
void