Skip to main content

Function: readBody()

readBody(uwsRes, req, maxBodySize?): Promise<boolean>

Defined in: service-core/src/http/uWS/Adapters.ts:331

Reads the full request body from a uWS response object as a Buffer. Body parsing (JSON / URL-encoded) is applied based on content-type and the result is cached on req.body / req.rawBody.

If the accumulated body exceeds maxBodySize, a 413 Payload Too Large response is written directly and the connection is ended — the caller must check the resolved value and skip running any further middleware/routing for this request when it's false, since a response has already been sent.

Parameters

uwsRes

HttpResponse

req

UWSRequest

maxBodySize?

number = DEFAULT_MAX_BODY_SIZE

Returns

Promise<boolean>

true if the body was read normally (or there was none to read), false if the request was rejected for exceeding maxBodySize.