#cors/tests.rs not active?
10 messages · Page 1 of 1 (latest)
Once you activate it it also doesn't pass by default. For it to pass two things have to happen:
- in cors/tests.rs:
Change order:
assert_eq!(vary_headers.next(), Some(&PERMISSIVE_CORS_VARY_HEADERS));
assert_eq!(vary_headers.next(), Some(&CUSTOM_VARY_HEADERS));
- in cors/mod.rs:
The vary header needs to be removed from response.headers_mut() I imagine instead of headers, given we want to "preserve" the response headers:
// vary header can have multiple values, don't overwrite
// previously-set value(s).
if let Some(vary) = response.headers_mut().remove(header::VARY) {
headers.append(header::VARY, vary);
}
Doing these 2 changes (after enabling the mod/tests.rs makes that test pass. But then again, not sure what the expected behaviour of the Vary order is when there are multiple. For now the order is changed and the originals are added to the end. I imagine that's okay? But you tell me. Otherwise you might need to change the logic as in the current code you're a bit bound to change of order.
Oh, oops!
Can you open an issue?
I think user-defined vary headers coming first would have been the expected behavior
But also doesn't seem super important which order
Want me to open an issue or immediately a PR? Or both?
Hm, since you already figured out a fix, a PR would work too
I'm not sure if this fix is right but still be easier to check from a diff