midtrans-client
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -20,3 +20,3 @@ 'use strict' | ||
'accept': 'application/json', | ||
'user-agent': 'midtransclient-nodejs/1.1.0' | ||
'user-agent': 'midtransclient-nodejs/1.1.1' | ||
}; | ||
@@ -58,3 +58,3 @@ return new Promise(function(resolve,reject){ | ||
// Reject API error HTTP status code | ||
if(res.status >= 300){ | ||
if(typeof res !== 'undefined' && res.status >= 300){ | ||
reject( | ||
@@ -68,2 +68,12 @@ new MidtransError( | ||
) | ||
// Reject API undefined HTTP response | ||
} else if(typeof res === 'undefined'){ | ||
reject( | ||
new MidtransError( | ||
`Midtrans API request failed. HTTP response not found, likely connection failure, with message: ${JSON.stringify(err.message)}`, | ||
null, | ||
null, | ||
err | ||
) | ||
) | ||
} | ||
@@ -76,2 +86,2 @@ reject(err); | ||
module.exports = HttpClient; | ||
module.exports = HttpClient; |
{ | ||
"name": "midtrans-client", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Official Midtrans Payment API Client for Node JS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
33156
413