Skip to content

Commit b276514

Browse files
committed
make run success on tide-0.9.0
1 parent 8e4b70e commit b276514

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/response.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async fn string_content_type() {
3939

4040
#[async_std::test]
4141
async fn json_content_type() {
42-
use http_types::Method;
42+
use http_types::{Method, Url};
4343
use std::collections::BTreeMap;
4444

4545
let mut app = tide::new();
@@ -53,18 +53,21 @@ async fn json_content_type() {
5353
});
5454
let req = http::Request::new(
5555
Method::Get,
56-
"http://localhost/json_content_type".parse().unwrap(),
56+
Url::parse("http://localhost/json_content_type").unwrap(),
5757
);
5858
let mut resp: http::Response = app.respond(req).await.unwrap();
5959
assert_eq!(resp.status(), StatusCode::InternalServerError);
6060
let body = resp.take_body().into_string().await.unwrap();
6161
assert_eq!(body.as_bytes(), b"");
6262

63-
let mut map = BTreeMap::new();
64-
map.insert("a", 2);
65-
map.insert("b", 4);
66-
map.insert("c", 6);
67-
let mut resp = Response::new(StatusCode::Ok).body_json(&map).unwrap();
63+
let mut resp = async move {
64+
let mut map = BTreeMap::new();
65+
map.insert("a", 2);
66+
map.insert("b", 4);
67+
map.insert("c", 6);
68+
Response::new(StatusCode::Ok).body_json(&map).unwrap()
69+
}
70+
.await;
6871
assert_eq!(resp.status(), StatusCode::Ok);
6972
let body = resp.take_body().into_string().await.unwrap();
7073
assert_eq!(body.as_bytes(), br##"{"a":2,"b":4,"c":6}"##);

0 commit comments

Comments
 (0)