MessageHeaders.setContentLength

void setContentLength(long contentLength)

Sets the message body length that hdrs will declare, and sets hdrs's encoding to [soup.types.Encoding.ContentLength].

You do not normally need to call this; if hdrs is set to use Content-Length encoding, libsoup will automatically set its Content-Length header for you immediately before sending the headers. One situation in which this method is useful is when generating the response to a HEAD request; Calling [soup.message_headers.MessageHeaders.setContentLength] allows you to put the correct content length into the response without needing to waste memory by filling in a response body which won't actually be sent.

Parameters

contentLengththe message body length