From 9026679cb7d93c3e234d9301d9b2b1a5e355290a Mon Sep 17 00:00:00 2001 From: boxdot Date: Sat, 16 Feb 2019 13:58:29 +0100 Subject: [PATCH] Add test for handlers returning unit. --- src/application.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/application.rs b/src/application.rs index d8a6cbe7b..70027d21a 100644 --- a/src/application.rs +++ b/src/application.rs @@ -824,6 +824,16 @@ mod tests { assert_eq!(resp.as_msg().status(), StatusCode::NOT_FOUND); } + #[test] + fn test_unit_responser() { + let app = App::new().resource("/unit", |r| r.f(|_| {})).finish(); + + let req = TestRequest::with_uri("/unit").request(); + let resp = app.run(req); + assert_eq!(resp.as_msg().status(), StatusCode::OK); + assert_eq!(resp.as_msg().body(), &Body::Empty); + } + #[test] fn test_option_responder() { let app = App::new()