This cheatsheet was collected famous CURL command for Software Developer. Exactly it's easy for checking and testing communicate between frontend and backend
if you want to see more information or option. Please see in : Curl man page
1.Request with set value specific header
curl --header "X-MyHeader: 123" URL
2.Request with using cookie
curl -v --cookie "COOKIEKEY=VALUE" URL
3.Request with method and body
curl -X HTTPMETHOD -H "Content-Type: application/json" -d '{"key1":"value"}' URL
4.Request with Form-data
curl -X POST -H "Content-Type: multipart/form-data;" -F "key1=val1" URL
5.Request with Post File
curl -X POST -F 'file=@/file-path.csv' URL
6.Get HTTP Status Only
curl -s -o /dev/null -w "%{http_code}" URL
7.Get Response Header only
curl -I https://www.google.com
8.Get Response value of specific header
(Example: for get content-type header)
curl -sI URL | tr -d '\r' | sed -En 's/^<u>content-type</u>: (.*)/\1/p'
Top comments (0)