document that Response::text consumes the body

Closes #302
This commit is contained in:
Sean McArthur
2018-05-31 12:01:44 -07:00
parent c5e1e0eddd
commit cf5deac02d

View File

@@ -183,6 +183,11 @@ impl Response {
/// # Ok(())
/// # }
/// ```
///
/// # Note
///
/// This consumes the body. Trying to read more, or use of `response.json()`
/// will return empty values.
pub fn text(&mut self) -> ::Result<String> {
let len = self.headers().get::<::header::ContentLength>()
.map(|ct_len| **ct_len)