diff options
author | Ali MJ Al-Nasrawy <alimjalnasrawy@gmail.com> | 2022-02-06 11:48:33 +0000 |
---|---|---|
committer | Ali MJ Al-Nasrawy <alimjalnasrawy@gmail.com> | 2022-02-06 11:48:33 +0000 |
commit | 0e6adbb3b53147f2e78a907909f6c470190ebaf3 (patch) | |
tree | dc25926d212f9f4cdd0ef2e3115e4c9496b6e01e /tests | |
parent | Merge 'jikstra/feat_route_prefix' #682 (diff) | |
download | miniserve-0e6adbb3b53147f2e78a907909f6c470190ebaf3.tar.gz miniserve-0e6adbb3b53147f2e78a907909f6c470190ebaf3.zip |
Fix route_prefix for css and favicon
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bind.rs | 1 | ||||
-rw-r--r-- | tests/serve_request.rs | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/tests/bind.rs b/tests/bind.rs index 1c816f0..0fa914e 100644 --- a/tests/bind.rs +++ b/tests/bind.rs @@ -53,6 +53,7 @@ fn bind_ipv4_ipv6( #[case(&["-i", "0.0.0.0"])] #[case(&["-i", "::", "-i", "0.0.0.0"])] #[case(&["--random-route"])] +#[case(&["--route-prefix", "/prefix"])] fn validate_printed_urls(tmpdir: TempDir, port: u16, #[case] args: &[&str]) -> Result<(), Error> { let mut child = Command::cargo_bin("miniserve")? .arg(tmpdir.path()) diff --git a/tests/serve_request.rs b/tests/serve_request.rs index 1491be9..d66ffd4 100644 --- a/tests/serve_request.rs +++ b/tests/serve_request.rs @@ -262,14 +262,14 @@ fn serve_index_instead_of_404_in_spa_mode( } #[rstest] -fn serves_requests_with_path_prefix( - #[with(["--route-prefix", "foobar"])] server: TestServer, -) -> Result<(), Error> { +#[case(server(&["--route-prefix", "foobar"]))] +#[case(server(&["--route-prefix", "/foobar/"]))] +fn serves_requests_with_route_prefix(#[case] 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 url_with_route = server.url().join("foobar")?; let status = reqwest::blocking::get(url_with_route)?.status(); assert_eq!(status, StatusCode::OK); |