aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2021-08-29 01:41:24 +0000
committerGitHub <noreply@github.com>2021-08-29 01:41:24 +0000
commit78b64b5401baa1a46eb25358dd6c9208dc30bba0 (patch)
treea99016ed85909dc74c258bbe90155ed6f736cb82 /tests
parentAdd CHANGELOG entry for visited colors (diff)
parentlist directory if index not found (diff)
downloadminiserve-78b64b5401baa1a46eb25358dd6c9208dc30bba0.tar.gz
miniserve-78b64b5401baa1a46eb25358dd6c9208dc30bba0.zip
Merge pull request #583 from aliemjay/index-fallback
list directory if index not found
Diffstat (limited to 'tests')
-rw-r--r--tests/serve_request.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/serve_request.rs b/tests/serve_request.rs
index 361801b..09a20d4 100644
--- a/tests/serve_request.rs
+++ b/tests/serve_request.rs
@@ -220,3 +220,14 @@ fn serves_requests_custom_index_notice(tmpdir: TempDir, port: u16) -> Result<(),
Ok(())
}
+
+#[rstest]
+#[case(server(&["--index", FILES[0]]))]
+#[case(server(&["--index", "does-not-exist.html"]))]
+fn index_fallback_to_listing(#[case] server: TestServer) -> Result<(), Error> {
+ // If index file is not found, show directory listing instead.
+ // both cases should return `Ok`
+ reqwest::blocking::get(server.url())?.error_for_status()?;
+
+ Ok(())
+}