Skip to content

Instantly share code, notes, and snippets.

@vbarbarosh
Last active May 18, 2019 17:57
Show Gist options
  • Save vbarbarosh/19676d1c8f606494cce392afdac52c60 to your computer and use it in GitHub Desktop.
Save vbarbarosh/19676d1c8f606494cce392afdac52c60 to your computer and use it in GitHub Desktop.
shell_curl_post_put_patch_delete – Sending POST|PUT|PATCH|DELETE requests with curl https://codescreens.com
#!/bin/bash
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o nounset -o errexit -o pipefail
# Sending POST|PUT|PATCH|DELETE requests with curl
# https://ec.haxx.se/http-post.html
# https://curl.haxx.se/docs/manpage.html
curl -X POST https://echo.vbarbarosh.com
# HTTP/1.1 POST /
#
# Host: echo.vbarbarosh.com
# User-Agent: curl/7.58.0
# [...]
curl -X PUT https://echo.vbarbarosh.com
# HTTP/1.1 PUT /
#
# Host: echo.vbarbarosh.com
# User-Agent: curl/7.58.0
# [...]
curl -X PATCH https://echo.vbarbarosh.com
# HTTP/1.1 PATCH /
#
# Host: echo.vbarbarosh.com
# User-Agent: curl/7.58.0
# [...]
curl -X DELETE https://echo.vbarbarosh.com
# HTTP/1.1 DELETE /
#
# Host: echo.vbarbarosh.com
# User-Agent: curl/7.58.0
# [...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment