Nothing works - _uri is undefined
Closed this issue · 6 comments
Borvik commented
Version 1.2.0 breaks everything, no config options are used and no URI is built to form proper paths.
// Old Version
var Api = function(config) {
this._protocol = config.protocol || 'http'; // or https
this._auth = (config.basicAuth) ? buildBasicAuthHeader(config.basicAuth) : '';
this._host = config.host || 'localhost';
this._port = config.port || '12900';
this._path = config.path || '';
this._uri = this._protocol + '://' + this._host + ':' + this._port + this._path;
};
// New Version
var Api = function(config) {
this._uri = this.uri;
};
hellobinge commented
yes, it breaks the uri. wasting like a hour in debugging the undefined uri...
let's just use version 1.1.6
GreyDelamar commented
+1
krundru commented
It broke my prod service and I had to downgrade this module. Here is the fix
var Api = function(config) {
config = config || {}
const basicAuthToken = config.basicAuth ?
config.basicAuth.username + ':' + config.basicAuth.password + '@' : ''
this._uri = (config.protocol || 'http') + '://' + basicAuthToken +
(config.host || 'localhost') + ':' + (config.port || '12900') +
(config.path || '')
};
krundru commented
Thanks for merging. May I know when it going to be published ?