http-cache icon indicating copy to clipboard operation
http-cache copied to clipboard

Missing headers

Open centromere opened this issue 2 months ago • 2 comments

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", ...}

centromere avatar Oct 28 '25 18:10 centromere

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.

centromere avatar Oct 28 '25 19:10 centromere

Thanks for the report! I'll make sure to address this in the next update.

06chaynes avatar Oct 28 '25 21:10 06chaynes