如何在请求 header 中为 curl 设置环境变量?
How can I set the environment variable in request header for curl?
如何在请求 header 中为 curl
设置环境变量
curl --location --request POST 'test.example.com' \
--header 'Content-Type: application/json' \
--header 'access_token: "${SOME_ENV_TOKEN}"' \
--header 'Authorization: Basic Og=='
不工作。
使用--header "access_token: \"${SOME_ENV_TOKEN}\""
'
引号禁用 sh 中的变量扩展。
如何在请求 header 中为 curl
设置环境变量curl --location --request POST 'test.example.com' \
--header 'Content-Type: application/json' \
--header 'access_token: "${SOME_ENV_TOKEN}"' \
--header 'Authorization: Basic Og=='
不工作。
使用--header "access_token: \"${SOME_ENV_TOKEN}\""
'
引号禁用 sh 中的变量扩展。