dufs/tests/cors.rs

34 lines
950 B
Rust
Raw Normal View History

2022-06-12 03:43:50 +03:00
mod fixtures;
mod utils;
use fixtures::{server, Error, TestServer};
use rstest::rstest;
#[rstest]
fn cors(#[with(&["--enable-cors"])] server: TestServer) -> Result<(), Error> {
2022-06-12 03:43:50 +03:00
let resp = reqwest::blocking::get(server.url())?;
assert_eq!(
resp.headers().get("access-control-allow-origin").unwrap(),
"*"
);
assert_eq!(
2022-07-08 11:18:10 +03:00
resp.headers()
.get("access-control-allow-credentials")
.unwrap(),
"true"
2022-06-12 03:43:50 +03:00
);
assert_eq!(
2022-07-08 11:18:10 +03:00
resp.headers().get("access-control-allow-methods").unwrap(),
"GET,HEAD,PUT,OPTIONS,DELETE,PROPFIND,COPY,MOVE"
2022-06-12 03:43:50 +03:00
);
assert_eq!(
resp.headers().get("access-control-allow-headers").unwrap(),
"Authorization,Destination,Range,Content-Type"
2022-07-08 11:18:10 +03:00
);
assert_eq!(
resp.headers().get("access-control-expose-headers").unwrap(),
"WWW-Authenticate,Content-Range,Accept-Ranges,Content-Disposition"
2022-06-12 03:43:50 +03:00
);
Ok(())
}