title: How to convert cURL to JSON
body: <p>I have a cURL command which performs an HTTP post successfully. I'm trying to replicate the http post in node using the request module. I can't get the node request to return successfully. What am I misunderstanding about cURL? To me, my http post using require seems to be exactly the same as the cURL command.</p>
  
  <pre><code>curl https://svcs.sandbox.paypal.com/AdaptivePayments/Pay \
  -s \
  --insecure \
  -H "X-PAYPAL-SECURITY-USERID: caller_1312486258_biz_api1.gmail.com" \
  -H "X-PAYPAL-SECURITY-PASSWORD: 1312486294" \
  -H "X-PAYPAL-SECURITY-SIGNATURE: AbtI7HV1xB428VygBUcIhARzxch4AL65.T18CTeylixNNxDZUu0iO87e" \
  -H "X-PAYPAL-REQUEST-DATA-FORMAT: JSON" \
  -H "X-PAYPAL-RESPONSE-DATA-FORMAT: JSON" \
  -H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" \
  -d '{
  "actionType":"PAY",
  "currencyCode":"USD",
  "receiverList":{
    "receiver":[
      {
        "amount":"1.00",
        "email":"rec1_1312486368_biz@gmail.com"
      }
    ]
  },
  "returnUrl":"http://www.example.com/success.html",
  "cancelUrl":"http://www.example.com/failure.html",
  "requestEnvelope":{
    "errorLanguage":"en_US",
    "detailLevel":"ReturnAll"
  }
  }'
  </code></pre>
  
  <p>and then here is the require http post</p>
  
  <pre><code> request.post(
    "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay",
    {
        "headers": {
            "X-PAYPAL-SECURITY-USERID": "caller_1312486258_biz_api1.gmail.com",
            "X-PAYPAL-SECURITY-PASSWORD": "1312486294",
            "X-PAYPAL-SECURITY-SIGNATURE": "AbtI7HV1xB428VygBUcIhARzxch4AL65.T18CTeylixNNxDZUu0iO87e",
            "X-PAYPAL-REQUEST-DATA-FORMAT": "JSON",
            "X-PAYPAL-RESPONSE-DATA-FORMAT": "JSON",
            "X-PAYPAL-APPLICATION-ID": "APP-80W284485P519543T"
        },
        "data": {
            "actionType":"PAY",
            "currencyCode":"USD",
            "receiverList":{
                "receiver":[
                    {
                        "amount":"1.00",
                        "email":"rec1_1312486368_biz@gmail.com"
                    }
                ]
            },
            "returnUrl":"http://www.example.com/success.html",
            "cancelUrl":"http://www.example.com/failure.html",
            "requestEnvelope":{
                "errorLanguage":"en_US",
                "detailLevel":"ReturnAll"
            }
        }
    },
    function (error, response, body) {
       console.log(body);
    }
  );
  </code></pre>
  
  <p>As far as I can tell there is no difference.</p>