dev4web
11/28/2016 - 10:20 AM

HTTP methods: It’s not only about GET and POST — First published in fullweb.io issue #76

HTTP methods: It’s not only about GET and POST — First published in fullweb.io issue #76

HTTP methods: It’s not only about GET and POST

HTML forms let us only use GET and POST methods, but HTTP provides us with more:

  • HEAD It works like GET but will not return the body. Useful for checking if the resource is 404 or has been updated (via caching headers).

  • PUT A way for HTTP to tell "create or update if exist" the resource at this URL with my payload.

  • PATCH Partially update the resource at this URL using the request payload.

  • DELETE No surprise here, DELETE asks for the resource at this URL be deleted.

  • OPTIONS HTTP’s own ls command. It returns the HTTP methods that the server supports at this URL.

  • TRACE A way to query for the changes on any intermediate server. Most of the time not supported.

  • CONNECT Used to create a transparent TCP/IP tunnel, most of the time to facilitate SSL communication through a proxy.