Open bofia opened 2 years ago
This would be a great pull request, and I like how the proposal is split into 3 separate isolated changes.
I assume for #1 you would use the normalization function right? Just thinking out loud - Does it make sense to have a "type" for the normalized vary header to avoid extra parsing in #2? String might be fine enough.
Is there a 4th function here, a "cache keys" function, that could return a map[string]string of cache keys or a similar interface? (i think actually hashing the keys should be done outside of this library - many different ways people might want to do that)
The
Vary
header can change the cacheability of a response. This library could add some helpers to account for it. A dev would probably want to create a cache key based on the headers inVary
Proposal:
CachableResponse
of[]string
that is the list of headers in theVary
header. E.g.["Accept-Language", "Accept-Encoding"]
http.Request
based on theVary
list