-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
It can be useful to allow custom verbs with something like hx-custom-verb-my_custom_verb attribute (and probably a configuration to push the authorized verbs)
The aim is to have way more explicit REST API
Take into account the simple case of changing a password :
Let say you PUT on /user/1, you have to check if their is a new password and update it, but what should you do if their is a change in name too ? Is it an allowed action ? Should you expect 2 different kind of payload ?
You can also PUT on /user/1/change-password, but you do not manipulate resources anymore as your URI.
The fact is you can bend REST to believe it work with the "basic" HTTP verbs, but when you do more than just CRUD, you soon reach your limit and compromise strongly the idea of CRUD or HATEOAS...
The HTTP specification allow use custom verbs and the implementation seems simple (I have something with working test with like +600 characters in htmx.js, that means +0.3%)
I think it will be rather difficult to add consistent behaviour with the rest of the verbs by doing it in an extension rather than in the main project.