Skip to content

Instantly share code, notes, and snippets.

@jessereynolds
Last active December 29, 2015 23:28
Show Gist options
  • Save jessereynolds/7742575 to your computer and use it in GitHub Desktop.
Save jessereynolds/7742575 to your computer and use it in GitHub Desktop.
which curl form do you prefer? Both do the same thing.
cat examples/contacts_ada_and_charles.json | \
curl -w 'response: %{http_code} \n' -X POST -H "Content-type: application/json" \
-d - http://localhost:3081/contacts
curl -w 'response: %{http_code} \n' -X POST -H "Content-type: application/json" \
-d - http://localhost:3081/contacts < examples/contacts_ada_and_charles.json
curl -w 'response: %{http_code} \n' -X POST -H "Content-type: application/json" \
-d @examples/contacts_ada_and_charles.json \
http://localhost:3081/contacts
@aussielunix
Copy link

pip install httpie
http POST http://localhost:3081/contacts < examples/contacts_ada_and_charles.json

https://github.com/jkbr/httpie

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