dufs/tests/cors.rs

34 lines
827 B
Rust
Raw Permalink 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(),
"*"
2022-06-12 03:43:50 +03:00
);
assert_eq!(
resp.headers().get("access-control-allow-headers").unwrap(),
"Authorization,*"
2022-07-08 11:18:10 +03:00
);
assert_eq!(
resp.headers().get("access-control-expose-headers").unwrap(),
"Authorization,*"
2022-06-12 03:43:50 +03:00
);
Ok(())
}