|
|
@@ -64,16 +64,20 @@ function sign(request, options) {
|
|
|
|
|
|
// generates a function to handle the https.request response object
|
|
|
function handleRequest(callback) {
|
|
|
-
|
|
|
return function (response) {
|
|
|
+ console.log('!!! statusCode:', response.statusCode);
|
|
|
+ console.log('!!! headers:', response.headers);
|
|
|
+
|
|
|
var responseBody = "";
|
|
|
|
|
|
response.on('data', function (chunk) {
|
|
|
+ console.log('!!! data:', { chunk });
|
|
|
responseBody += chunk;
|
|
|
});
|
|
|
|
|
|
response.on('end', function () {
|
|
|
- callback(JSON.parse(responseBody));
|
|
|
+ console.log('!!! end:', { responseBody });
|
|
|
+ callback(responseBody ? JSON.parse(responseBody) : "");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -156,10 +160,12 @@ function healthCheck(callback) {
|
|
|
// console.log(data);
|
|
|
// });
|
|
|
|
|
|
-getInvoices(function (data) {
|
|
|
- console.log(data);
|
|
|
+healthCheck(function (data) {
|
|
|
+ console.log("+++ healthCheck");
|
|
|
+ console.log("+++", data);
|
|
|
});
|
|
|
|
|
|
-// healthCheck(function (data) {
|
|
|
-// console.log(data);
|
|
|
-// });
|
|
|
+getInvoices(function (data) {
|
|
|
+ console.log("+++ getInvoices");
|
|
|
+ console.log("+++", data);
|
|
|
+});
|