Skip to content

Commit 398551f

Browse files
committed
Merge pull request #13 from 74nk/master
Bugfix: additional check added (issue #12)
2 parents 53af49e + a81525b commit 398551f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

lib/requests.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ function send(config, options, callback) {
2626

2727
var url = config.getBaseURL() + path + "?" + queryString;
2828

29-
handler[options.method.toLowerCase()]({
30-
url: url,
31-
proxy: config.proxy,
32-
timeout: config.timeout,
33-
headers: {
34-
'content-type': (body ? 'application/json' : undefined)
35-
},
36-
body: body
37-
}, function(err, res, resBody) {
29+
var params = {
30+
url: url,
31+
proxy: config.proxy,
32+
timeout: config.timeout
33+
};
34+
35+
if(body) {
36+
params.headers = {'content-type': 'application/json'};
37+
params.body = body;
38+
}
39+
40+
handler[options.method.toLowerCase()](params, function(err, res, resBody) {
3841
dispatchRequestResult(err, url, this.req, res, callback);
3942
});
4043
}

0 commit comments

Comments
 (0)