refactored the code a bit to use new https request library

This commit is contained in:
Almir Kadric
2014-08-28 07:56:13 +00:00
parent e64281bcf0
commit ce778d0628
3 changed files with 36 additions and 53 deletions

View File

@@ -15,6 +15,13 @@ module.exports = function (url, options, cb) {
'content-type': 'application/x-www-form-urlencoded',
'content-length': Buffer.byteLength(data)
};
} else if (data.json) {
data = JSON.stringify(data.json);
delete options.json;
options.headers = {
'content-type': 'application/json',
'content-length': Buffer.byteLength(data)
};
}
} catch (error) {
cb(error);