aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2022-02-06 10:12:19 +0000
committerAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2022-02-06 10:12:19 +0000
commit8e0930cc9f25e44a69f61763ac5ff38ba58bb3dd (patch)
treee9500f4d2180984fe7981205c44ac89048f1019c /tests
parentMerge pull request #725 from aliemjay/update_actix_web (diff)
parentApply alimjays suggestion (diff)
downloadminiserve-8e0930cc9f25e44a69f61763ac5ff38ba58bb3dd.tar.gz
miniserve-8e0930cc9f25e44a69f61763ac5ff38ba58bb3dd.zip
Merge 'jikstra/feat_route_prefix' #682
Diffstat (limited to 'tests')
-rw-r--r--tests/serve_request.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/serve_request.rs b/tests/serve_request.rs
index ec2c978..1491be9 100644
--- a/tests/serve_request.rs
+++ b/tests/serve_request.rs
@@ -260,3 +260,18 @@ fn serve_index_instead_of_404_in_spa_mode(
Ok(())
}
+
+#[rstest]
+fn serves_requests_with_path_prefix(
+ #[with(["--route-prefix", "foobar"])] server: TestServer,
+) -> Result<(), Error> {
+ let url_without_route = server.url();
+ let status = reqwest::blocking::get(url_without_route)?.status();
+ assert_eq!(status, StatusCode::NOT_FOUND);
+
+ let url_with_route = format!("{}{}", server.url(), "foobar");
+ let status = reqwest::blocking::get(url_with_route)?.status();
+ assert_eq!(status, StatusCode::OK);
+
+ Ok(())
+}