htmx icon indicating copy to clipboard operation
htmx copied to clipboard

Document mutual incompatibility of hx-{delete,get,patch,post,put}

Open adamchainz opened this issue 5 years ago • 3 comments

These attributes all change the HTTP method. They're presumably incompatible - but what does this do? Does it cause an error, is there a specificity order?

adamchainz avatar Dec 02 '20 18:12 adamchainz

I have no idea what that will do. :/ Well, I imagine it will do all of them, but that's just a guess.

We can update the docs to say so, for sure.

1cg avatar Dec 02 '20 19:12 1cg

So I did some testing on this and if multiple attributes are specified at the same time, one method will take precedence and only one request is launched, where hx-get has highest priority and hx-patch the lowest.

GET,POST,PUT,PATCH,DELETE => GET POST,PUT,PATCH,DELETE => POST PUT,PATCH,DELETE => PUT PATCH,DELETE => DELETE

I can make a PR with some docs if necessary.

aburd avatar Feb 22 '24 13:02 aburd

I believe the order is defined here, where downstream functions eventually parse for the hx elements. @bencroker do we still want this noted in the docs? PR to follow.

samfurr avatar Jun 09 '24 01:06 samfurr