1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-23 23:51:06 +01:00

test woth with_params

This commit is contained in:
Nikolay Kim 2017-10-16 09:58:54 -07:00
parent 88a81155bd
commit 02033724d8

View File

@ -75,3 +75,15 @@ fn test_request_query() {
assert_eq!(query[0].0.as_ref(), "id"); assert_eq!(query[0].0.as_ref(), "id");
assert_eq!(query[0].1.as_ref(), "test"); assert_eq!(query[0].1.as_ref(), "test");
} }
#[test]
fn test_request_params() {
let req = HttpRequest::new(Method::GET, Uri::try_from("/?id=test").unwrap(),
Version::HTTP_11, HeaderMap::new());
let mut params = Params::new();
params.insert("key".to_owned(), "value".to_owned());
let req = req.with_params(params);
assert_eq!(req.params().find("key"), Some("value"));
}