Skip to content

Commit 7bd8922

Browse files
committed
Body::into_string returns crate::Result
1 parent c69b9ff commit 7bd8922

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/body.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl Body {
219219
/// assert_eq!(&body.into_string().await.unwrap(), "Hello Nori");
220220
/// # Ok(()) }) }
221221
/// ```
222-
pub async fn into_string(mut self) -> io::Result<String> {
222+
pub async fn into_string(mut self) -> crate::Result<String> {
223223
let mut result = String::with_capacity(self.len().unwrap_or(0));
224224
self.read_to_string(&mut result).await?;
225225
Ok(result)

src/request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl Request {
304304
/// assert_eq!(&req.body_string().await.unwrap(), "Hello Nori");
305305
/// # Ok(()) }) }
306306
/// ```
307-
pub async fn body_string(self) -> io::Result<String> {
307+
pub async fn body_string(self) -> crate::Result<String> {
308308
self.body.into_string().await
309309
}
310310

@@ -441,7 +441,7 @@ impl Request {
441441
/// use http_types::{Url, Method, Request};
442442
///
443443
/// let mut req = Request::new(Method::Get, Url::parse("https://example.com")?);
444-
/// req.append_header("Content-Type", "text/plain")?;
444+
/// req.append_header("Content-Type", "text/plain");
445445
/// #
446446
/// # Ok(()) }
447447
/// ```

src/response.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl Response {
126126
/// use http_types::{Response, StatusCode};
127127
///
128128
/// let mut res = Response::new(StatusCode::Ok);
129-
/// res.append_header("Content-Type", "text/plain")?;
129+
/// res.append_header("Content-Type", "text/plain");
130130
/// #
131131
/// # Ok(()) }
132132
/// ```
@@ -261,7 +261,7 @@ impl Response {
261261
/// assert_eq!(&res.body_string().await.unwrap(), "Hello Nori");
262262
/// # Ok(()) }) }
263263
/// ```
264-
pub async fn body_string(self) -> io::Result<String> {
264+
pub async fn body_string(self) -> crate::Result<String> {
265265
self.body.into_string().await
266266
}
267267

src/security/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,5 @@ pub fn referrer_policy(mut headers: impl AsMut<Headers>, referrer: Option<Referr
220220

221221
// We MUST allow for multiple Referrer-Policy headers to be set.
222222
// See: https://w3c.github.io/webappsec-referrer-policy/#unknown-policy-values example #13
223-
headers.as_mut().append("Referrer-Policy", policy).unwrap();
223+
headers.as_mut().append("Referrer-Policy", policy);
224224
}

src/trailers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl Trailers {
108108
/// use http_types::Trailers;
109109
///
110110
/// let mut trailers = Trailers::new();
111-
/// trailers.append("Content-Type", "text/plain")?;
111+
/// trailers.append("Content-Type", "text/plain");
112112
/// #
113113
/// # Ok(()) }
114114
/// ```

0 commit comments

Comments
 (0)