Skip to content

Documentation is out of date / incorrect. #186

@mwalkersigma

Description

@mwalkersigma

hpAgent gives this sample for using the library with GOT

got('http://localhost:9200', {
  agent: {
    http: new HttpProxyAgent({
      keepAlive: true,
      keepAliveMsecs: 1000,
      maxSockets: 256,
      maxFreeSockets: 256,
      scheduling: 'lifo',
      proxy: 'http://localhost:8080'
    })
  }
})

Your code directly assigns whatever the user lists as a proxy agent to proxy agent

const requestOptions = {
      method: 'GET',
      resolveWithFullResponse: true,
      gzip: true,
      responseType: 'buffer',
      headers: this.requestHeaders,
      https: {
        rejectUnauthorized: this.rejectUnauthorized,
      },
      agent: this.proxyAgent,
    };

The documentation should either reflect by updating your advanced example like so :

proxyAgent: {
                http: new HttpProxyAgent({
                    proxy: proxyUrl
                }),
            },

or you need to update your code so that it infers which agent was provided and does the assignment itself.

agent instanceof HttpProxyAgent -> then { http: HttpProxyAgent }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions