Skip to content

Commit

Permalink
Prevent absent statusCode error
Browse files Browse the repository at this point in the history
  • Loading branch information
jaggedsoft authored Jun 21, 2020
1 parent 9680ac8 commit 7b67119
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions node-binance-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ let api = function Binance( options = {} ) {
const reqHandler = cb => ( error, response, body ) => {
Binance.info.lastRequest = new Date().getTime();
if ( response ) {
Binance.info.statusCode = response.statusCode;
Binance.info.statusCode = response.statusCode || 0;
if ( response.request ) Binance.info.lastURL = response.request.uri.href;
if ( response.headers ) {
Binance.info.usedWeight = response.headers['x-mbx-used-weight-1m'] || 0;
Expand Down Expand Up @@ -459,8 +459,8 @@ let api = function Binance( options = {} ) {
if ( error ) return reject( error );
try {
Binance.info.lastRequest = new Date().getTime();
Binance.info.statusCode = response.statusCode;
if ( response ) {
Binance.info.statusCode = response.statusCode || 0;
if ( response.request ) Binance.info.lastURL = response.request.uri.href;
if ( response.headers ) {
Binance.info.usedWeight = response.headers['x-mbx-used-weight-1m'] || 0;
Expand Down

0 comments on commit 7b67119

Please sign in to comment.