1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-24 07:53:00 +01:00

test for query parameters in client

This commit is contained in:
François Mockers 2018-03-14 21:45:49 +01:00
parent 0f064db31d
commit ad6b823255

View File

@ -66,6 +66,21 @@ fn test_simple() {
assert_eq!(bytes, Bytes::from_static(STR.as_ref())); 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] #[test]
fn test_no_decompress() { fn test_no_decompress() {
let mut srv = test::TestServer::new( let mut srv = test::TestServer::new(