How can I set the environment variable in request header for curl?

Viewed 1650

How can I set the environment variable in request header for curl

curl --location --request POST 'test.example.com' \
--header 'Content-Type: application/json' \
--header 'access_token: "${SOME_ENV_TOKEN}"' \
--header 'Authorization: Basic Og=='

Not working.

1 Answers

Use --header "access_token: \"${SOME_ENV_TOKEN}\""

The ' quotes disable variable expansion in sh.

Related