You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
922 B
38 lines
922 B
3 years ago
|
mod fixtures;
|
||
|
mod utils;
|
||
|
|
||
|
use fixtures::{server, Error, TestServer};
|
||
|
use rstest::rstest;
|
||
|
|
||
|
#[rstest]
|
||
|
fn cors(#[with(&["--cors"])] server: TestServer) -> Result<(), Error> {
|
||
|
let resp = reqwest::blocking::get(server.url())?;
|
||
|
|
||
|
assert_eq!(
|
||
|
resp.headers().get("access-control-allow-origin").unwrap(),
|
||
|
"*"
|
||
|
);
|
||
|
assert_eq!(
|
||
|
resp.headers().get("access-control-allow-headers").unwrap(),
|
||
|
"range, content-type, accept, origin, www-authenticate"
|
||
|
);
|
||
|
|
||
|
Ok(())
|
||
|
}
|
||
|
|
||
|
#[rstest]
|
||
|
fn cors_options(#[with(&["--cors"])] server: TestServer) -> Result<(), Error> {
|
||
|
let resp = fetch!(b"OPTIONS", server.url()).send()?;
|
||
|
|
||
|
assert_eq!(
|
||
|
resp.headers().get("access-control-allow-origin").unwrap(),
|
||
|
"*"
|
||
|
);
|
||
|
assert_eq!(
|
||
|
resp.headers().get("access-control-allow-headers").unwrap(),
|
||
|
"range, content-type, accept, origin, www-authenticate"
|
||
|
);
|
||
|
|
||
|
Ok(())
|
||
|
}
|