From 5634e5794f571904706d21c2b327560bbb4a7ba3 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 20 Feb 2018 13:03:21 -0800 Subject: [PATCH] more tests for NormalizePath helper --- src/handler.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/handler.rs b/src/handler.rs index 734f04ef..400dfa5c 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -493,6 +493,7 @@ mod tests { ("/resource1/a/b", "", StatusCode::OK), ("//resource1//a//b", "/resource1/a/b", StatusCode::MOVED_PERMANENTLY), ("//resource1//a//b/", "/resource1/a/b", StatusCode::MOVED_PERMANENTLY), + ("//resource1//a//b//", "/resource1/a/b", StatusCode::MOVED_PERMANENTLY), ("///resource1//a//b", "/resource1/a/b", StatusCode::MOVED_PERMANENTLY), ("/////resource1/a///b", "/resource1/a/b", StatusCode::MOVED_PERMANENTLY), ("/////resource1/a//b/", "/resource1/a/b", StatusCode::MOVED_PERMANENTLY), @@ -502,6 +503,7 @@ mod tests { ("///resource1//a//b?p=1", "/resource1/a/b?p=1", StatusCode::MOVED_PERMANENTLY), ("/////resource1/a///b?p=1", "/resource1/a/b?p=1", StatusCode::MOVED_PERMANENTLY), ("/////resource1/a//b/?p=1", "/resource1/a/b?p=1", StatusCode::MOVED_PERMANENTLY), + ("/////resource1/a//b//?p=1", "/resource1/a/b?p=1", StatusCode::MOVED_PERMANENTLY), ]; for (path, target, code) in params { let req = app.prepare_request(TestRequest::with_uri(path).finish()); @@ -532,6 +534,7 @@ mod tests { ("/resource1/a/b/", "", StatusCode::NOT_FOUND), ("//resource2//a//b", "/resource2/a/b/", StatusCode::MOVED_PERMANENTLY), ("//resource2//a//b/", "/resource2/a/b/", StatusCode::MOVED_PERMANENTLY), + ("//resource2//a//b//", "/resource2/a/b/", StatusCode::MOVED_PERMANENTLY), ("///resource1//a//b", "/resource1/a/b", StatusCode::MOVED_PERMANENTLY), ("///resource1//a//b/", "/resource1/a/b", StatusCode::MOVED_PERMANENTLY), ("/////resource1/a///b", "/resource1/a/b", StatusCode::MOVED_PERMANENTLY), @@ -552,6 +555,7 @@ mod tests { ("///resource1//a//b/?p=1", "/resource1/a/b?p=1", StatusCode::MOVED_PERMANENTLY), ("/////resource1/a///b?p=1", "/resource1/a/b?p=1", StatusCode::MOVED_PERMANENTLY), ("/////resource1/a///b/?p=1", "/resource1/a/b?p=1", StatusCode::MOVED_PERMANENTLY), + ("/////resource1/a///b//?p=1", "/resource1/a/b?p=1", StatusCode::MOVED_PERMANENTLY), ("/resource2/a/b?p=1", "/resource2/a/b/?p=1", StatusCode::MOVED_PERMANENTLY), ("//resource2//a//b?p=1", "/resource2/a/b/?p=1", StatusCode::MOVED_PERMANENTLY), ("//resource2//a//b/?p=1", "/resource2/a/b/?p=1", StatusCode::MOVED_PERMANENTLY),