Closed gouravbatra closed 7 years ago
Error:- request is not defined at Function.doRequest (/node_modules/sendotp/index.js:161:9)
Code in index.js:- request(options, function(error, response, data) { // request error if (error) { return callback(error, data, response); }
// JSON parse error or empty strings try { // An empty string is a valid response if (data === '') { data = {}; } else { data = JSON.parse(data); } } catch(parseError) { return callback( new Error('JSON parseError with HTTP Status: ' + response.statusCode + ' ' + response.statusMessage), data, response ); } // response object errors // This should return an error object not an array of errors if (data.errors !== undefined) { return callback(data.errors, data, response); } // status code errors if(response.statusCode < 200 || response.statusCode > 299) { return callback( new Error('HTTP Error: ' + response.statusCode + ' ' + response.statusMessage), data, response ); } // no errors callback(null, data, response); });
I think there is a bug that.. in index.js they dint required 'request' module. Add require('../request') in index.js file of sendotp module.
Issue resolved, changes are pushed you may take a pull.
Error:- request is not defined at Function.doRequest (/node_modules/sendotp/index.js:161:9)
Code in index.js:- request(options, function(error, response, data) { // request error if (error) { return callback(error, data, response); }