request-json
Advanced tools
Comparing version 0.2.5 to 0.2.7
34
main.js
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
var fs, request; | ||
var fs, parseBody, request; | ||
@@ -9,2 +9,13 @@ request = require("request"); | ||
parseBody = function(error, response, body, callback) { | ||
try { | ||
if (typeof body === "string") { | ||
body = JSON.parse(body); | ||
} | ||
return callback(error, response, body); | ||
} catch (err) { | ||
return callback(error, response, body); | ||
} | ||
}; | ||
exports.JsonClient = (function() { | ||
@@ -24,10 +35,3 @@ | ||
}, function(error, response, body) { | ||
try { | ||
if (typeof body === "string") { | ||
body = JSON.parse(body); | ||
} | ||
return callback(error, response, body); | ||
} catch (err) { | ||
return callback(error, response, body); | ||
} | ||
return parseBody(error, response, body, callback); | ||
}); | ||
@@ -41,3 +45,5 @@ }; | ||
json: json | ||
}, callback); | ||
}, function(error, response, body) { | ||
return parseBody(error, response, body, callback); | ||
}); | ||
}; | ||
@@ -50,3 +56,5 @@ | ||
json: json | ||
}, callback); | ||
}, function(error, response, body) { | ||
return parseBody(error, response, body, callback); | ||
}); | ||
}; | ||
@@ -58,3 +66,5 @@ | ||
uri: this.host + path | ||
}, callback); | ||
}, function(error, response, body) { | ||
return parseBody(error, response, body, callback); | ||
}); | ||
}; | ||
@@ -61,0 +71,0 @@ |
@@ -16,3 +16,3 @@ { | ||
], | ||
"version": "0.2.5", | ||
"version": "0.2.7", | ||
"homepage": "https://github.com/mycozycloud/request-json/", | ||
@@ -19,0 +19,0 @@ "bugs": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4833
70