Skip to content

Commit 7c02ce2

Browse files
committed
Remove: println!() and some lines
1 parent cb247aa commit 7c02ce2

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

tests/response.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use tide::*;
44
async fn test_status() {
55
let mut resp = Response::new(StatusCode::NotFound).body_string("foo".to_string());
66
assert_eq!(resp.status(), StatusCode::NotFound);
7-
87
let foo = resp.take_body().into_string().await.unwrap();
98
assert_eq!(foo.as_bytes(), b"foo");
109
}
@@ -16,14 +15,12 @@ async fn byte_vec_content_type() {
1615
use std::str::FromStr;
1716

1817
let mut resp = Response::new(StatusCode::Ok).body(Cursor::new("foo"));
19-
2018
let mut header_values: Vec<HeaderValue> = Vec::new();
2119
let content_type = HeaderName::from_str("Content-Type").unwrap();
2220
if let Some(x) = resp.remove_header(&content_type) {
2321
header_values = x;
2422
}
2523
assert_eq!(header_values[0], "application/octet-stream");
26-
2724
let foo = resp.take_body().into_string().await.unwrap();
2825
assert_eq!(foo.as_bytes(), b"foo");
2926
}
@@ -34,14 +31,12 @@ async fn string_content_type() {
3431
use std::str::FromStr;
3532

3633
let mut resp = Response::new(StatusCode::Ok).body_string("foo".to_string());
37-
3834
let mut header_values: Vec<HeaderValue> = Vec::new();
3935
let content_type = HeaderName::from_str("Content-Type").unwrap();
4036
if let Some(x) = resp.remove_header(&content_type) {
4137
header_values = x;
4238
}
4339
assert_eq!(header_values[0], "text/plain; charset=utf-8");
44-
4540
let foo = resp.take_body().into_string().await.unwrap();
4641
assert_eq!(foo.as_bytes(), b"foo");
4742
}
@@ -57,30 +52,24 @@ async fn json_content_type() {
5752
map.insert(Some("a"), 2);
5853
map.insert(Some("b"), 4);
5954
map.insert(None, 6);
60-
println!("{:?}", serde_json::to_vec(&map));
61-
6255
let resp = Response::new(StatusCode::Ok).body_json(&map)?;
6356
Ok(resp)
6457
});
65-
6658
let req = http::Request::new(
6759
Method::Get,
6860
"http://localhost/json_content_type".parse().unwrap(),
6961
);
7062
let mut resp: http::Response = app.respond(req).await.unwrap();
7163
assert_eq!(resp.status(), StatusCode::InternalServerError);
72-
7364
let body = resp.take_body().into_string().await.unwrap();
7465
assert_eq!(body.as_bytes(), b"");
7566

7667
let mut map = BTreeMap::new();
7768
map.insert("a", 2);
7869
map.insert("b", 4);
7970
map.insert("c", 6);
80-
8171
let mut resp = Response::new(StatusCode::Ok).body_json(&map).unwrap();
8272
assert_eq!(resp.status(), StatusCode::Ok);
83-
8473
let body = resp.take_body().into_string().await.unwrap();
8574
assert_eq!(body.as_bytes(), br##"{"a":2,"b":4,"c":6}"##);
8675
}

0 commit comments

Comments
 (0)