http-cache
http-cache copied to clipboard
Missing headers
When making a HEAD request directly with curl or reqwest, I see multiple Vary headers, as expected:
➜ ~ curl --head -s http://fedora.local.lan/rest/hello/fcr:metadata | grep Vary
Vary: Prefer
Vary: Accept
Vary: Range
Vary: Accept-Encoding
Vary: Accept-Language
Vary: Accept-Datetime
➜ ~
let response = self.http_client
.head(url)
.send().await?;
info!("response headers: {:?}", response.headers());
[*] response headers: {"server": "Jetty(12.0.23)", ..., "vary": "Prefer", "vary": "Accept", "vary": "Range", "vary": "Accept-Encoding", "vary": "Accept-Language", "vary": "Accept-Datetime"}
When making the same request with the http_cache_reqwest::Cache middleware, I only see one:
[*] response headers: {"x-cache-lookup": "MISS", "vary": "Accept-Datetime", ...}
Because it's valid for multiple headers with the same name to appear in a response, it's more appropriate to use a multimap instead of a hashmap.
Thanks for the report! I'll make sure to address this in the next update.