How do I properly use 'curl add header' to include custom headers in my requests?

16 Replies, 1486 Views

Yo, noob questions are how we all learn, so no worries! For `curl add header`, your approach is correct. Stacking `-H` flags works perfectly.

If you’re dealing with a lot of headers, you can also use a config file with `--config` to keep things clean. Like:
```
url = "https://example.com"
header = "Authorization: Bearer mytoken"
header = "Header2: value2"
```
Save it as `curl.conf` and run `curl --config curl.conf`. Makes life easier!

Messages In This Thread



Users browsing this thread: 1 Guest(s)