How Do I Properly Use 'curl add header' to Include Custom Headers in My Requests?

30 Replies, 3106 Views

Hey there! Just wanted to add that you can also use a file to store headers if you have a lot of them. Use `--header @filename.txt` with curl add header.

For example, create a file `headers.txt` with:
```
Authorization: Bearer mytoken
Content-Type: application/json
```

Then run:
```
curl --header @headers.txt https://example.com
```

Saves a lot of typing!

Messages In This Thread



Users browsing this thread: 1 Guest(s)