diff --git a/src/async_impl/response.rs b/src/async_impl/response.rs index cb2f4ec15..f88e32179 100644 --- a/src/async_impl/response.rs +++ b/src/async_impl/response.rs @@ -79,13 +79,18 @@ impl Response { self.res.headers_mut() } - /// Get the content-length of this response, if known. + /// Get the content length of the response, if it is known. + /// + /// This value does not directly represents the value of the `Content-Length` + /// header, but rather the size of the response's body. To read the header's + /// value, please use the [`Response::headers`] method instead. /// /// Reasons it may not be known: /// - /// - The server didn't send a `content-length` header. - /// - The response is compressed and automatically decoded (thus changing - /// the actual decoded length). + /// - The response does not include a body (e.g. it responds to a `HEAD` + /// request). + /// - The response is gzipped and automatically decoded (thus changing the + /// actual decoded length). pub fn content_length(&self) -> Option { use hyper::body::Body; diff --git a/src/blocking/response.rs b/src/blocking/response.rs index 3c2e1d879..d626fd437 100644 --- a/src/blocking/response.rs +++ b/src/blocking/response.rs @@ -188,13 +188,19 @@ impl Response { self.inner.extensions_mut() } - /// Get the content-length of the response, if it is known. + /// Get the content length of the response, if it is known. + /// + /// + /// This value does not directly represents the value of the `Content-Length` + /// header, but rather the size of the response's body. To read the header's + /// value, please use the [`Response::headers`] method instead. /// /// Reasons it may not be known: /// - /// - The server didn't send a `content-length` header. - /// - The response is gzipped and automatically decoded (thus changing - /// the actual decoded length). + /// - The response does not include a body (e.g. it responds to a `HEAD` + /// request). + /// - The response is gzipped and automatically decoded (thus changing the + /// actual decoded length). pub fn content_length(&self) -> Option { self.inner.content_length() }