Collect the entire contents of this `Body`, and expose it as `Bytes`. This async fn will be pending until the entire `Body` is copied into memory, or an error occurs.
(&mut self)
| 177 | /// This async fn will be pending until the entire `Body` is |
| 178 | /// copied into memory, or an error occurs. |
| 179 | pub async fn bytes_contents(&mut self) -> Result<Bytes, Error> { |
| 180 | let _ = self.contents().await?; |
| 181 | match &self.0 { |
| 182 | BodyInner::Complete { data, .. } => Ok(data.clone()), |
| 183 | _ => unreachable!(), |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | /// Get a value for the length of this `Body`'s content, in bytes, if |
| 188 | /// known. This value can come from either the Content-Length header |