mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 23:51:06 +01:00
add access-control-request-* headers to vary response header
This commit is contained in:
parent
8540b61a13
commit
6d6b045b3a
@ -118,12 +118,16 @@ impl<S> CorsMiddleware<S> {
|
|||||||
if inner.vary_header {
|
if inner.vary_header {
|
||||||
let value = match res.headers_mut().get(header::VARY) {
|
let value = match res.headers_mut().get(header::VARY) {
|
||||||
Some(hdr) => {
|
Some(hdr) => {
|
||||||
let mut val: Vec<u8> = Vec::with_capacity(hdr.len() + 8);
|
let mut val: Vec<u8> = Vec::with_capacity(hdr.len() + 71);
|
||||||
val.extend(hdr.as_bytes());
|
val.extend(hdr.as_bytes());
|
||||||
val.extend(b", Origin");
|
val.extend(
|
||||||
|
b", Origin, Access-Control-Request-Method, Access-Control-Request-Headers",
|
||||||
|
);
|
||||||
val.try_into().unwrap()
|
val.try_into().unwrap()
|
||||||
}
|
}
|
||||||
None => HeaderValue::from_static("Origin"),
|
None => HeaderValue::from_static(
|
||||||
|
"Origin, Access-Control-Request-Method, Access-Control-Request-Headers",
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
res.headers_mut().insert(header::VARY, value);
|
res.headers_mut().insert(header::VARY, value);
|
||||||
|
Loading…
Reference in New Issue
Block a user