bigskysoftware / bigskysoftware/htmx

New feature : Support custom http verbs

Open
#3,535 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.