Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nepsilon/191e652ae97d39be2b1dc8cb28c9ffd7 to your computer and use it in GitHub Desktop.
Save nepsilon/191e652ae97d39be2b1dc8cb28c9ffd7 to your computer and use it in GitHub Desktop.
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment