From 50966272bff840ecb6e538c5acc6d5306ee967bd Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Fri, 8 Nov 2019 16:04:36 +0100 Subject: [PATCH] remove Response::ok Signed-off-by: Yoshua Wuyts --- src/response/into_response.rs | 4 ++-- tests/server.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/response/into_response.rs b/src/response/into_response.rs index d719eae60..23e88e0e8 100644 --- a/src/response/into_response.rs +++ b/src/response/into_response.rs @@ -41,7 +41,7 @@ pub trait IntoResponse: Send + Sized { impl IntoResponse for String { fn into_response(self) -> Response { - Response::ok() + Response::new(200) .set_header("Content-Type", "text/plain; charset=utf-8") .body_string(self) } @@ -49,7 +49,7 @@ impl IntoResponse for String { impl IntoResponse for Request { fn into_response(self) -> Response { - Response::ok().body(self) + Response::new(200).body(self) } } diff --git a/tests/server.rs b/tests/server.rs index f7f4d335f..6ce74bc58 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -11,7 +11,7 @@ fn hello_world() -> Result<(), surf::Exception> { let mut app = tide::new(); app.at("/").get(|mut req: tide::Request<()>| async move { assert_eq!(req.body_string().await.unwrap(), "nori".to_string()); - tide::Response::ok().body_string("says hello".to_string()) + tide::Response::new(200).body_string("says hello".to_string()) }); app.listen("localhost:8080").await?; Result::<(), surf::Exception>::Ok(()) @@ -67,7 +67,7 @@ fn json() -> Result<(), surf::Exception> { let mut counter: Counter = req.body_json().await.unwrap(); assert_eq!(counter.count, 0); counter.count = 1; - tide::Response::ok().body_json(&counter).unwrap() + tide::Response::new(200).body_json(&counter).unwrap() }); app.listen("localhost:8082").await?; Result::<(), surf::Exception>::Ok(())