Add test for handlers returning unit.

This commit is contained in:
boxdot 2019-02-16 13:58:29 +01:00
parent 6a23d82dce
commit 9026679cb7
1 changed files with 10 additions and 0 deletions

View File

@ -824,6 +824,16 @@ mod tests {
assert_eq!(resp.as_msg().status(), StatusCode::NOT_FOUND); 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] #[test]
fn test_option_responder() { fn test_option_responder() {
let app = App::new() let app = App::new()