Skip to content

Instantly share code, notes, and snippets.

@pranav7
Last active August 29, 2015 14:06
Show Gist options
  • Save pranav7/7a18c262a81d474f2306 to your computer and use it in GitHub Desktop.
Save pranav7/7a18c262a81d474f2306 to your computer and use it in GitHub Desktop.
Output Response HTTP Status of a cURL Request

Output Response HTTP Status of a cURL Request


Append -w "\nSTATUS: %{http_code}\n" at the end of your cURL call.

-w helps you to write an output after completion

-s optional - can be added to silent other outputs from the curl request

Example:
curl -X PUT -H "Accept: application/json" -H http://yourapp.com/api/endpoint -w "\n\nSTATUS: %{http_code}\n\n"


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