Googi
Googi

Reputation: 600

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

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.

Upvotes: 3

Views: 6277

Answers (1)

1N4001
1N4001

Reputation: 196

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

The ' quotes disable variable expansion in sh.

Upvotes: 5

Related Questions