Hacker News new | ask | show | jobs
by acabal 1496 days ago
I've always been shocked that HTML forms only support GET and POST and there's zero interest in supporting more HTTP methods in forms even in 2022. If forms supported the whole range of HTTP methods we could have a user facing web that's identical to a REST API, with different Accept and Content-type headers. Imagine how much development time we could save if forms supported DELETE and PUT!
6 comments

Does that save us much time? In the systems I've worked on, the problems of deletions and edits aren't HTTP verbs, they're wild, complex business rules around authentication, authorization, auditing, etc.
it's incredible that we got WebGL, Web Assembly and a million other things that are neat, but not really crucial to a proper hypermedia implementation, but they can't give us DELETE, PUT and PATCH in HTML, even though they are sitting there in HTTP just staring us in the face!

the irony is that DELETE, PUT and PATCH are used today almost exclusively in non-hypermedia JSON data APIs

crazy world!

That's pretty silly. This is like claiming the world would be fundamentally different if we used <em> instead of <b>. Anyone who thinks this is remotely useful is already doing it by either using ajax or by just overloading POST. We do not save development time by renaming a concept.
> Imagine how much development time we could save if forms supported DELETE and PUT!

not much; while you need a little (easily reusable) JS code to use and handle responses to other methods, it's such a tiny fraction of the dev effort that goes into web apps that it makes no meaningful difference.

It would be nice if HTML forms supported other methods for completeness, but it wouldn't save all that much real-world development effort.

The W3C attempted to improve HTML forms with xForms, but the browser vendors are deathly afraid of anything XML based so it never got implemented.

These days HTML is really only viewed as a payload carrier for your JS application so doubt that'll ever change either.

You know you can update or delete a resource by using GET or POST?
You can, but it is not the proper way to work HTTP.