Document that HX-Trigger headers are ignored on 302s
Closed this issue · 4 comments
Please clearly document that HX-Trigger
won't trigger events on endpoints that return redirects (#2052)
Hey, yep as said in the issue you linked
We never see the 3xx response, that is handled internally by the browser. We only see the eventual 2xx, 4xx or 5xx responses.
So unfortunately we can't do much about this.
So this affects HX-Trigger
but really all other headers you might send along a 302 response. This is a common gotcha and could indeed be beneficial to make clearer in the docs.
PRs are always welcome to improve the documentation, if you feel like it!
Added some documentation around this in a PR for review.
One thing I noticed when testing and reviewing the code for how htmx handles the headers is that we have a couple of duplications in the checking and handling of the HX-Retarget and HX-Reswap headers. see dev...MichaelWest22:htmx:duplicate-header-checks where I tested removing the duplicates and I checked carefully that the first header fetches were indeed not required. No major perf gain removing them just makes the code more readable.
@boosh updated documentation is now live can you check and close the issue if your happy with it?
LGTM thanks