Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Commit

Permalink
fix reqOptions usage.
Browse files Browse the repository at this point in the history
thanks to:
- https://github.com/matthiaskomarek/nodejs-ebay-api/commit/c7e89ec2633ac1acf62af82c0d3c63db3697a28c
- afreeland@1281b07

fixed issue #15

also remove overloaded and unnecessary `var request`.
  • Loading branch information
benbuckman committed Oct 3, 2015
1 parent deb6e79 commit 69b0cdf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ exports.ebayApiGetRequest = function ebayApiGetRequest(options, callback) {

console.log('url for', options.opType, 'request:\n', url.replace(/\&/g, '\n&'));

var request = request.get({'url':url, 'headers': options.reqOptions}, function(error, response, result) {
request.get({
'url': url,
'headers': options.reqOptions.headers
}, function(error, response, result) {
var data;

if (error) {
Expand Down Expand Up @@ -362,8 +365,12 @@ exports.ebayApiPostXmlRequest = function ebayApiPostXmlRequest(options, callback
options.reqOptions.data = buildXmlInput(options.opType, options.params);
// console.log(options.reqOptions.data);

var request = request.post({'url': url, 'headers': options.reqOptions}, function(error, response, result) {
if (result instanceof Error) {
request.post({
'url': url,
'body': options.reqOptions.data,
'headers': options.reqOptions.headers
}, function(error, response, result) {
if (result instanceof Error) {
var error = result;
error.message = "Completed with error: " + error.message;
return callback(error);
Expand Down

0 comments on commit 69b0cdf

Please sign in to comment.