docs(headers): clarify TransferEncoding xor ContentLength
Update the docs for `Content-Length` and `Transfer-Encoding` to mention that they are mutually exclusive, and that setting one will unset the other, in accordance with RFC7230. Also expand the docs for `Request::set_body` to say that chunked encoding is used by default, and mention how to disable this feature.
This commit is contained in:
@@ -91,6 +91,10 @@ impl<B> Request<B> {
|
||||
pub fn set_version(&mut self, version: HttpVersion) { self.version = version; }
|
||||
|
||||
/// Set the body of the request.
|
||||
///
|
||||
/// By default, the body will be sent using `Transfer-Encoding: chunked`. To
|
||||
/// override this behavior, manually set a [`ContentLength`] header with the
|
||||
/// length of `body`.
|
||||
#[inline]
|
||||
pub fn set_body<T: Into<B>>(&mut self, body: T) { self.body = Some(body.into()); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user