1
0
Fork 0
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:
Dominic 2020-05-13 19:10:53 +02:00
parent 40c90e6b4a
commit 748bf65d3e
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
4 changed files with 169 additions and 1 deletions

View file

@ -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
}