buildHeaders(contextOptions={}) {
    let headers = {};

    if (this._userConfig.isNode) {
      // Can't set User-Agent in browser
      headers['User-Agent'] = this._userConfig.userAgent;
    }

    if (this._userConfig.useBrowserCookies) {
      headers['X-User-Agent'] = this._userConfig.userAgent;

      if (this._modhash.hasModhash() && !this._modhash.isModhashOld()) {
        headers['X-Modhash'] = this._modhash.getCurrentModhash();
      }
    }

    if (!this._userConfig.useBrowserCookies) {
      if (contextOptions.bypassAuth || this.isApplicationOnly()) {
        headers['Authorization'] = this._oauthAppOnly.getAuthorizationHeader();
      } else {
        headers['Authorization'] = this._oauth.getAuthorizationHeader();
      }
    }

    return headers;
  }
/*
     Builds up the headers for an endpoint.
   */
Builds up the headers for an endpoint.
Builds up the headers for an endpoint .
buildHeaders(contextOptions={}) {
    let headers = {};
    if (this._userConfig.isNode) {
      headers['User-Agent'] = this._userConfig.userAgent;
    }
    if (this._userConfig.useBrowserCookies) {
      headers['X-User-Agent'] = this._userConfig.userAgent;
      if (this._modhash.hasModhash() && !this._modhash.isModhashOld()) {
        headers['X-Modhash'] = this._modhash.getCurrentModhash();
      }
    }
    if (!this._userConfig.useBrowserCookies) {
      if (contextOptions.bypassAuth || this.isApplicationOnly()) {
        headers['Authorization'] = this._oauthAppOnly.getAuthorizationHeader();
      } else {
        headers['Authorization'] = this._oauth.getAuthorizationHeader();
      }
    }
    return headers;
  }
buildHeaders ( contextOptions = { } ) { let headers = { } ; if ( this . _userConfig . isNode ) { headers [ 'User-Agent' ] = this . _userConfig . userAgent ; } if ( this . _userConfig . useBrowserCookies ) { headers [ 'X-User-Agent' ] = this . _userConfig . userAgent ; if ( this . _modhash . hasModhash ( ) && ! this . _modhash . isModhashOld ( ) ) { headers [ 'X-Modhash' ] = this . _modhash . getCurrentModhash ( ) ; } } if ( ! this . _userConfig . useBrowserCookies ) { if ( contextOptions . bypassAuth || this . isApplicationOnly ( ) ) { headers [ 'Authorization' ] = this . _oauthAppOnly . getAuthorizationHeader ( ) ; } else { headers [ 'Authorization' ] = this . _oauth . getAuthorizationHeader ( ) ; } } return headers ; }
Builds up the headers for an endpoint.
Builds up the headers for an endpoint .
// Can't set User-Agent in browser