mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-05-09 16:10:42 +00:00
cors for non-preflight requests
This commit is contained in:
parent
40c90e6b4a
commit
748bf65d3e
4 changed files with 169 additions and 1 deletions
|
@ -100,10 +100,16 @@ fn response_from(res : Response, state : &State) -> gotham::hyper::Response<Body
|
|||
{
|
||||
r.headers_mut().insert(CONTENT_TYPE, mime.as_ref().parse().unwrap());
|
||||
}
|
||||
if Method::borrow_from(state) != Method::HEAD
|
||||
|
||||
let method = Method::borrow_from(state);
|
||||
if method != Method::HEAD
|
||||
{
|
||||
*r.body_mut() = res.body;
|
||||
}
|
||||
|
||||
#[cfg(feature = "cors")]
|
||||
crate::cors::handle_cors(state, &mut r);
|
||||
|
||||
r
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue