mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-04-20 06:54:46 +00:00
cors tests
This commit is contained in:
parent
f20c768d02
commit
74ef0af512
4 changed files with 160 additions and 10 deletions
|
@ -166,7 +166,7 @@ pub fn handle_cors(state : &State, res : &mut Response<Body>)
|
|||
let config = CorsConfig::try_borrow_from(state);
|
||||
let headers = res.headers_mut();
|
||||
|
||||
// non-preflight requests require nothing other than the Access-Control-Allow-Origin header
|
||||
// non-preflight requests require the Access-Control-Allow-Origin header
|
||||
if let Some(header) = config.and_then(|cfg| cfg.origin.header_value(state))
|
||||
{
|
||||
headers.insert(ACCESS_CONTROL_ALLOW_ORIGIN, header);
|
||||
|
|
|
@ -10,6 +10,7 @@ pub use content_type::ContentTypeMatcher;
|
|||
|
||||
#[cfg(feature = "cors")]
|
||||
mod access_control_request_method;
|
||||
#[cfg(feature = "cors")]
|
||||
pub use access_control_request_method::AccessControlRequestMethodMatcher;
|
||||
|
||||
type LookupTable = HashMap<String, Vec<usize>>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue