index.js
function validateBody(err, body) {
      body = tryParse(body);

      if (err || !body) {
        return next(err || new Error('Unparsable response with statusCode ' + statusCode));
      }

      if (statusCode !== 200) {
        return next(new Error(body.message || 'Invalid status code ' + statusCode));
      }

      next(null, body);
    }
function validateBody(err, body) {
      body = tryParse(body);

      if (err || !body) {
        return next(err || new Error('Unparsable response with statusCode ' + statusCode));
      }

      if (statusCode !== 200) {
        return next(new Error(body.message || 'Invalid status code ' + statusCode));
      }

      next(null, body);
    }
function validateBody ( err , body ) { body = tryParse ( body ) ; if ( err || ! body ) { return next ( err || new Error ( 'Unparsable response with statusCode ' + statusCode ) ) ; } if ( statusCode !== 200 ) { return next ( new Error ( body . message || 'Invalid status code ' + statusCode ) ) ; } next ( null , body ) ; }
If a callback is passed, validate the returned body
If a callback is passed validate the returned body