Closed imbolc closed 6 months ago
I agree, this would make sense to add. That API seems fine. Would you like to open a PR for this?
Done
The same Vary header value should be used on all responses for a given URL, including 304 Not Modified responses and the "default" response. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary
Shouldn't we also (or instead) add a layer (middleware) to add a single Vary: hx-request, hx-target, hx-trigger, hx-trigger-name
header to every response?
I've been thinking about this for a bit, and I can't come up with any issues off the top of my head. Are there any potentially problematic implications of applying this header to every response going through the middleware?
Either way, if we do add a middleware, it should live alongside the individual options for flexibility's sake.
Ok, I've opened a separate issue for this
Differentiating response based on
hx-request
/hx-trigger
involves a caching issue. A way of dealing with it is correspondingVary
response headers. Maybe we add vary responders e.g.VaryHxRequest
and convenience methods on extractorsHxRequest::vary_header() -> VaryHxRequest
?