Skip to content

Commit

Permalink
Fix Response doc-tests to actually use Response
Browse files Browse the repository at this point in the history
Some of them were testing the methods from `Request` instead.
  • Loading branch information
goto-bus-stop committed Feb 26, 2020
1 parent 9eee21d commit ccb9460
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 ccb9460

Please sign in to comment.