hasBody property
bool
get
hasBody
Returns whether the request has a body.
For HTTP/1.1, a body is present when content-length > 0 or when transfer-encoding is chunked. If content-length is unknown and not chunked, treat it as no body to avoid hanging drains.
Implementation
bool get hasBody {
final length = _httpRequest.contentLength;
if (length > 0) return true;
if (length == 0) return false;
return _httpRequest.headers.chunkedTransferEncoding;
}