Problem
When a handler sends a body on a HEAD request, the payload goes over the wire. HTTP spec (RFC 9110 §9.3.2) requires HEAD responses to have identical headers to GET but no body.
Current Behavior
@All()
allHandler(@Res() res: UwsResponse) {
res.status(200).json({ handler: 'all' }); // Body sent even for HEAD
}
HEAD /all-test → 200 OK with JSON body in the response.
Root Cause
uWS is low-level and doesn't strip bodies for HEAD. Our adapter passes the handler's body straight through to uwsRes.end() without checking the request method.
Fix
In UwsResponse._sendInternal(), before calling uwsRes.end(body), check this.req?.method === 'HEAD'. If true, write headers but call uwsRes.end() with no body (or uwsRes.endWithoutBody(length)).
Problem
When a handler sends a body on a HEAD request, the payload goes over the wire. HTTP spec (RFC 9110 §9.3.2) requires HEAD responses to have identical headers to GET but no body.
Current Behavior
HEAD /all-test→200 OKwith JSON body in the response.Root Cause
uWS is low-level and doesn't strip bodies for HEAD. Our adapter passes the handler's body straight through to
uwsRes.end()without checking the request method.Fix
In
UwsResponse._sendInternal(), before callinguwsRes.end(body), checkthis.req?.method === 'HEAD'. If true, write headers but calluwsRes.end()with no body (oruwsRes.endWithoutBody(length)).