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