fix: don't search on empty query string (#140)

* fix: don't search on empty query string

* refactor

Co-authored-by: sigoden <sigoden@gmail.com>
This commit is contained in:
David Politis
2022-11-10 21:02:55 +11:00
committed by GitHub
parent bd07783cde
commit 1a9990f04e
3 changed files with 43 additions and 32 deletions

View File

@@ -98,6 +98,15 @@ fn head_dir_search(#[with(&["-A"])] server: TestServer) -> Result<(), Error> {
Ok(())
}
#[rstest]
fn empty_search(#[with(&["-A"])] server: TestServer) -> Result<(), Error> {
let resp = reqwest::blocking::get(format!("{}?q=", server.url()))?;
assert_eq!(resp.status(), 200);
let paths = utils::retrieve_index_paths(&resp.text()?);
assert!(paths.is_empty());
Ok(())
}
#[rstest]
fn get_file(server: TestServer) -> Result<(), Error> {
let resp = reqwest::blocking::get(format!("{}index.html", server.url()))?;