node-js-libs / curlrequest

A cURL wrapper
MIT License
184 stars 44 forks source link

How do i include parameters to be passed while making the request? #25

Closed lprimeroo closed 9 years ago

lprimeroo commented 9 years ago

as in request parameters .

chriso commented 9 years ago

Use the data option.

If you want to make a POST request with content type application/x-www-form-urlencoded:

curl.request({
    url: 'http://example.com/',
    data: {'foo': 'bar'}
}, function (err, response) {

});

If you want to make a GET request, then either use curl.request('http://example.com/?foo=bar', ...), or the long form version:

curl.request({
    get: true,
    url: 'http://example.com/',
    data: {'foo': 'bar'},
}, function (err, response) {

});