Class: UWSResponse
Defined in: service-core/src/http/uWS/Adapters.ts:146
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:164
Parameters
uwsRes
HttpResponse
Returns
UWSResponse
Properties
isHead
isHead:
boolean=false
Defined in: service-core/src/http/uWS/Adapters.ts:158
Set to true for HEAD requests — body bytes must not be sent.
result?
optionalresult?:any
Defined in: service-core/src/http/uWS/Adapters.ts:160
Intermediate result passed between middleware.
Implementation of
Accessors
headersSent
Get Signature
get headersSent():
boolean
Defined in: service-core/src/http/uWS/Adapters.ts:179
Returns
boolean
Implementation of
statusCode
Get Signature
get statusCode():
number
Defined in: service-core/src/http/uWS/Adapters.ts:175
Returns
number
Implementation of
writableEnded
Get Signature
get writableEnded():
boolean
Defined in: service-core/src/http/uWS/Adapters.ts:183
Returns
boolean
Implementation of
Methods
appendHeader()
appendHeader(
key,value):this
Defined in: service-core/src/http/uWS/Adapters.ts:197
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
end()
end(
data?):void
Defined in: service-core/src/http/uWS/Adapters.ts:229
Parameters
data?
any
Returns
void
Implementation of
flushHeaders()
flushHeaders():
void
Defined in: service-core/src/http/uWS/Adapters.ts:264
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:210
Parameters
key
string
Returns
string | string[] | undefined
Implementation of
json()
json(
data):void
Defined in: service-core/src/http/uWS/Adapters.ts:214
Parameters
data
any
Returns
void
Implementation of
onAbort()
onAbort(
callback):void
Defined in: service-core/src/http/uWS/Adapters.ts:306
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:316
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:219
Parameters
data?
any
Returns
void
Implementation of
setHeader()
setHeader(
key,value):this
Defined in: service-core/src/http/uWS/Adapters.ts:192
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:187
Parameters
code
number
Returns
this
Implementation of
write()
write(
data):void
Defined in: service-core/src/http/uWS/Adapters.ts:295
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