function TravisStatusHttp(endpoint, options) {
  if (endpoint && typeof endpoint !== 'string') {
    throw new TypeError('endpoint must be a string');
  }
  endpoint = endpoint && trimSlash(endpoint);

  if (options && typeof options !== 'object') {
    throw new TypeError('options must be an object');
  }

  options = Object.assign({gzip: true}, options);
  options.headers = Object.assign({}, options.headers);

  // Careful about providing default values for case-insensitive headers
  const caselessHeaders = caseless(options.headers);
  // The Travis CI API docs say
  // "Always set the Accept header to application/vnd.travis-ci.2+json"
  // but the API actually sends Content-Type application/json.
  // Declare that we accept either.
  if (!caselessHeaders.has('Accept')) {
    options.headers.Accept =
      'application/vnd.travis-ci.2+json, application/json';
  }
  if (!caselessHeaders.has('User-Agent')) {
    options.headers['User-Agent'] = DEFAULT_USER_AGENT;
  }

  TravisHttp.call(
    this,
    endpoint === constants.PRO_URI,
    options.headers
  );

  this._endpoint = endpoint || constants.ORG_URI;
  // Set this._headers as TravisHttp does
  this._headers = options.headers;
  delete options.headers;
  this._options = options;
}
function TravisStatusHttp(endpoint, options) {
  if (endpoint && typeof endpoint !== 'string') {
    throw new TypeError('endpoint must be a string');
  }
  endpoint = endpoint && trimSlash(endpoint);

  if (options && typeof options !== 'object') {
    throw new TypeError('options must be an object');
  }

  options = Object.assign({gzip: true}, options);
  options.headers = Object.assign({}, options.headers);

  // Careful about providing default values for case-insensitive headers
  const caselessHeaders = caseless(options.headers);
  // The Travis CI API docs say
  // "Always set the Accept header to application/vnd.travis-ci.2+json"
  // but the API actually sends Content-Type application/json.
  // Declare that we accept either.
  if (!caselessHeaders.has('Accept')) {
    options.headers.Accept =
      'application/vnd.travis-ci.2+json, application/json';
  }
  if (!caselessHeaders.has('User-Agent')) {
    options.headers['User-Agent'] = DEFAULT_USER_AGENT;
  }

  TravisHttp.call(
    this,
    endpoint === constants.PRO_URI,
    options.headers
  );

  this._endpoint = endpoint || constants.ORG_URI;
  // Set this._headers as TravisHttp does
  this._headers = options.headers;
  delete options.headers;
  this._options = options;
}
function TravisStatusHttp ( endpoint , options ) { if ( endpoint && typeof endpoint !== 'string' ) { throw new TypeError ( 'endpoint must be a string' ) ; } endpoint = endpoint && trimSlash ( endpoint ) ; if ( options && typeof options !== 'object' ) { throw new TypeError ( 'options must be an object' ) ; } options = Object . assign ( { gzip : true } , options ) ; options . headers = Object . assign ( { } , options . headers ) ; // Careful about providing default values for case-insensitive headers const caselessHeaders = caseless ( options . headers ) ; // The Travis CI API docs say // "Always set the Accept header to application/vnd.travis-ci.2+json" // but the API actually sends Content-Type application/json. // Declare that we accept either. if ( ! caselessHeaders . has ( 'Accept' ) ) { options . headers . Accept = 'application/vnd.travis-ci.2+json, application/json' ; } if ( ! caselessHeaders . has ( 'User-Agent' ) ) { options . headers [ 'User-Agent' ] = DEFAULT_USER_AGENT ; } TravisHttp . call ( this , endpoint === constants . PRO_URI , options . headers ) ; this . _endpoint = endpoint || constants . ORG_URI ; // Set this._headers as TravisHttp does this . _headers = options . headers ; delete options . headers ; this . _options = options ; }
Creates an instance of the travis-ci HTTP agent with a given endpoint
and request options.

This class has the following features above <code>TravisHttp</code>:
- Uses a newer version of request (for gzip and proxy support)
- Supports caller-specified API endpoints (e.g. for enterprise or local use)
- Supports caller-specified request options (e.g. pooling, strictSSL, proxy,
tunnel, timeouts, etc.)
- Improved error values which are real Error instances and include the
HTTP response information, regardless of content.

@param {string=} endpoint Travis CI API endpoint (base URL).
(default: {@link TravisStatusChecker.ORG_URI})
@param {Object=} options Options to pass to the <code>request</code>
constructor.
Creates an instance of the travis - ci HTTP agent with a given endpoint and request options .