Skip to content

Commit 892b03b

Browse files
authored
Merge pull request #76 from http-rs/really-use-response
Fix `Response` doc-tests to actually use `Response`
2 parents 660e4db + ccb9460 commit 892b03b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/response.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ impl Response {
8383
/// ```
8484
/// # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
8585
/// #
86-
/// use http_types::{Url, Method, Request};
86+
/// use http_types::{Url, Method, Response, StatusCode};
8787
///
88-
/// let mut req = Request::new(Method::Get, Url::parse("https://example.com")?);
88+
/// let mut req = Response::new(StatusCode::Ok);
8989
/// req.insert_header("Content-Type", "text/plain")?;
9090
/// #
9191
/// # Ok(()) }
@@ -145,7 +145,7 @@ impl Response {
145145
}
146146
}
147147

148-
/// Replace the request body with a new body, returning the old body.
148+
/// Replace the response body with a new body, returning the old body.
149149
///
150150
/// # Examples
151151
///
@@ -154,9 +154,9 @@ impl Response {
154154
/// # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
155155
/// # async_std::task::block_on(async {
156156
/// #
157-
/// use http_types::{Body, Url, Method, Request};
157+
/// use http_types::{Body, Url, Method, Response, StatusCode};
158158
///
159-
/// let mut req = Request::new(Method::Get, Url::parse("https://example.com")?);
159+
/// let mut req = Response::new(StatusCode::Ok);
160160
/// req.set_body("Hello, Nori!");
161161
///
162162
/// let mut body: Body = req.replace_body("Hello, Chashu");
@@ -181,9 +181,9 @@ impl Response {
181181
/// # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
182182
/// # async_std::task::block_on(async {
183183
/// #
184-
/// use http_types::{Body, Url, Method, Request};
184+
/// use http_types::{Body, Url, Method, Response, StatusCode};
185185
///
186-
/// let mut req = Request::new(Method::Get, Url::parse("https://example.com")?);
186+
/// let mut req = Response::new(StatusCode::Ok);
187187
/// req.set_body("Hello, Nori!");
188188
///
189189
/// let mut body = "Hello, Chashu!".into();
@@ -199,7 +199,7 @@ impl Response {
199199
mem::swap(&mut self.body, body);
200200
}
201201

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

0 commit comments

Comments
 (0)