kolomiichenko/graylog-api

Nothing works - _uri is undefined

Closed this issue · 6 comments

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;
};

yes, it breaks the uri. wasting like a hour in debugging the undefined uri...

let's just use version 1.1.6

+1

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 || '')
};

Here is the PR: #14

Pls review and merge it. thanks

Thanks for merging. May I know when it going to be published ?

Hi @some-say . I think this issue can be closed since the fix was already merged on the PR #14 . The PR was just not linked to this issue, so it was not closed automatically 😄