feat: add option --allow-hash to allow/disallow file hashing (#657)

This commit is contained in:
sigoden
2026-01-09 16:43:18 +08:00
committed by GitHub
parent ca18df1a36
commit 2b2c7bd5f7
4 changed files with 28 additions and 2 deletions

View File

@@ -203,7 +203,7 @@ fn head_file(server: TestServer) -> Result<(), Error> {
}
#[rstest]
fn hash_file(server: TestServer) -> Result<(), Error> {
fn hash_file(#[with(&["--allow-hash"])] server: TestServer) -> Result<(), Error> {
let resp = reqwest::blocking::get(format!("{}index.html?hash", server.url()))?;
assert_eq!(
resp.headers().get("content-type").unwrap(),
@@ -217,6 +217,13 @@ fn hash_file(server: TestServer) -> Result<(), Error> {
Ok(())
}
#[rstest]
fn no_hash_file(server: TestServer) -> Result<(), Error> {
let resp = reqwest::blocking::get(format!("{}index.html?hash", server.url()))?;
assert_eq!(resp.status(), 403);
Ok(())
}
#[rstest]
fn get_file_404(server: TestServer) -> Result<(), Error> {
let resp = reqwest::blocking::get(format!("{}404", server.url()))?;