我正在尝试在Node中实现curl请求。在curl中,您可以执行以下POST请求:
curl -v https://api.sandbox.paypal.com/v1/oauth2/token \
-H "Accept: application/json" \
-H "Accept-Language: en_US" \
-u "client_id:client_secret" \
-d "grant_type=client_credentials"
我知道如何使用Node.js的http
模块设置头部和编写数据有效负载,但是如何使用http
模块实现-u client_id:client_secret
?