We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 279e0f0 commit 7c2046aCopy full SHA for 7c2046a
tests/head_response_empty_body.rs
@@ -0,0 +1,23 @@
1
+#![feature(async_await)]
2
+
3
+use futures::executor::block_on;
4
+use http_service::Body;
5
+use http_service_mock::make_server;
6
+use tide::Context;
7
8
+async fn ok(_cx: Context<()>) -> String {
9
+ String::from("this shouldn't exist in the body of a HEAD response")
10
+}
11
12
+#[test]
13
+fn head_response_empty() {
14
+ let mut app = tide::App::new();
15
+ app.at("/").get(ok);
16
+ let mut server = make_server(app.into_http_service()).unwrap();
17
18
+ let req = http::Request::head("/").body(Body::empty()).unwrap();
19
+ let res = server.simulate(req).unwrap();
20
+ let body = block_on(res.into_body().into_vec()).unwrap();
21
+ dbg!(&String::from_utf8(body));
22
+ //assert!(body.is_empty());
23
0 commit comments