2022-06-12 03:43:50 +03:00
|
|
|
mod fixtures;
|
|
|
|
mod utils;
|
|
|
|
|
|
|
|
use fixtures::{server, Error, TestServer};
|
|
|
|
use rstest::rstest;
|
|
|
|
|
|
|
|
#[rstest]
|
2022-06-19 12:27:09 +03:00
|
|
|
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(),
|
2022-07-08 11:18:10 +03:00
|
|
|
"Authorization,Destination,Range"
|
|
|
|
);
|
|
|
|
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(())
|
|
|
|
}
|