Function

get-known-length

Returns a u64 body length if the length of a body is known, or none otherwise.

If the length is unknown, it is likely due to the body arising from an HTTP/1.1 message with chunked encoding, an HTTP/2 or later message with no content-length, or being a streaming body.

Receiving a length from this function does not guarantee that the full number of bytes can actually be read from the body. For example, when proxying a response from a backend, this length may reflect the content-length promised in the response, but if the backend connection is closed prematurely, fewer bytes may be delivered before this body handle can no longer be read.

get-known-length: func(body: borrow​<body>) -> option​<u64>;