How Do You Properly Format Headers in cURL Requests? or What’s the Best Way to Include Headers in a c

17 Replies, 2222 Views

Headers curl gotcha: On Linux/macOS, single vs double quotes matter if you’re using variables. Double quotes expand vars, single don’t.

Example:
`curl -H "Authorization: Bearer $TOKEN"` vs `curl -H 'Authorization: Bearer $TOKEN'`

Also, if your header value has colons or spaces, wrap it in quotes. Some servers freak out otherwise.

For debugging, I swear by https://reqbin.com/—lets you test headers curl requests live.

Messages In This Thread



Users browsing this thread: 1 Guest(s)