1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 09:59:21 +02:00

fix router cannot parse Non-ASCII characters in URL #137

This commit is contained in:
Nikolay Kim
2018-03-28 16:10:58 -07:00
parent 4f7d45ee9c
commit 90e3aaaf8a
5 changed files with 46 additions and 9 deletions

View File

@ -61,3 +61,20 @@ fn test_query_extractor() {
let response = srv.execute(request.send()).unwrap();
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
}
#[test]
fn test_non_ascii_route() {
let mut srv = test::TestServer::new(|app| {
app.resource("/中文/index.html", |r| r.f(|_| "success"));
});
// client request
let request = srv.get().uri(srv.url("/中文/index.html"))
.finish().unwrap();
let response = srv.execute(request.send()).unwrap();
assert!(response.status().is_success());
// read response
let bytes = srv.execute(response.body()).unwrap();
assert_eq!(bytes, Bytes::from_static(b"success"));
}