1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 17:22:57 +01:00

add access-control-request-* headers to vary response header

This commit is contained in:
Rob Ede 2022-01-01 23:05:29 +00:00
parent 8540b61a13
commit 6d6b045b3a
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933

View File

@ -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);