Skip to content

Commit

Permalink
Merge pull request #76 from http-rs/really-use-response
Browse files Browse the repository at this point in the history
Fix `Response` doc-tests to actually use `Response`
  • Loading branch information
yoshuawuyts authored Mar 3, 2020
2 parents 660e4db + ccb9460 commit 892b03b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ impl Response {
/// ```
/// # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
/// #
/// use http_types::{Url, Method, Request};
/// use http_types::{Url, Method, Response, StatusCode};
///
/// let mut req = Request::new(Method::Get, Url::parse("https://example.com")?);
/// let mut req = Response::new(StatusCode::Ok);
/// req.insert_header("Content-Type", "text/plain")?;
/// #
/// # Ok(()) }
Expand Down Expand Up @@ -145,7 +145,7 @@ impl Response {
}
}

/// Replace the request body with a new body, returning the old body.
/// Replace the response body with a new body, returning the old body.
///
/// # Examples
///
Expand All @@ -154,9 +154,9 @@ impl Response {
/// # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
/// # async_std::task::block_on(async {
/// #
/// use http_types::{Body, Url, Method, Request};
/// use http_types::{Body, Url, Method, Response, StatusCode};
///
/// let mut req = Request::new(Method::Get, Url::parse("https://example.com")?);
/// let mut req = Response::new(StatusCode::Ok);
/// req.set_body("Hello, Nori!");
///
/// let mut body: Body = req.replace_body("Hello, Chashu");
Expand All @@ -181,9 +181,9 @@ impl Response {
/// # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
/// # async_std::task::block_on(async {
/// #
/// use http_types::{Body, Url, Method, Request};
/// use http_types::{Body, Url, Method, Response, StatusCode};
///
/// let mut req = Request::new(Method::Get, Url::parse("https://example.com")?);
/// let mut req = Response::new(StatusCode::Ok);
/// req.set_body("Hello, Nori!");
///
/// let mut body = "Hello, Chashu!".into();
Expand All @@ -199,7 +199,7 @@ impl Response {
mem::swap(&mut self.body, body);
}

/// Take the request body, replacing it with an empty body.
/// Take the response body, replacing it with an empty body.
///
/// # Examples
///
Expand All @@ -208,9 +208,9 @@ impl Response {
/// # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
/// # async_std::task::block_on(async {
/// #
/// use http_types::{Body, Url, Method, Request};
/// use http_types::{Body, Url, Method, Response, StatusCode};
///
/// let mut req = Request::new(Method::Get, Url::parse("https://example.com")?);
/// let mut req = Response::new(StatusCode::Ok);
/// req.set_body("Hello, Nori!");
/// let mut body: Body = req.take_body();
///
Expand Down

0 comments on commit 892b03b

Please sign in to comment.