From ad6b8232550aca62db5675cbbeaa2ab6d479fbf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Wed, 14 Mar 2018 21:45:49 +0100 Subject: [PATCH] test for query parameters in client --- tests/test_client.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_client.rs b/tests/test_client.rs index ef34d39a5..f8a9cdffc 100644 --- a/tests/test_client.rs +++ b/tests/test_client.rs @@ -66,6 +66,21 @@ fn test_simple() { assert_eq!(bytes, Bytes::from_static(STR.as_ref())); } +#[test] +fn test_with_query_parameter() { + let mut srv = test::TestServer::new( + |app| app.handler(|req: HttpRequest| match req.query().get("qp") { + Some(_) => httpcodes::HTTPOk.build().finish(), + None => httpcodes::HTTPBadRequest.build().finish(), + })); + + let request = srv.get().uri(srv.url("/?qp=5").as_str()).finish().unwrap(); + + let response = srv.execute(request.send()).unwrap(); + assert!(response.status().is_success()); +} + + #[test] fn test_no_decompress() { let mut srv = test::TestServer::new(