telegraf / telegraf-wit

wit.ai middleware for Telegraf
MIT License
34 stars 5 forks source link

Allow use behind proxy #3

Open rlogiacco opened 6 years ago

rlogiacco commented 6 years ago

To allow setting a proxy I've added the use of the agent option in the following two sections of code

https://github.com/telegraf/telegraf-wit/blob/94534277cdbb0ff787d11fc6d0999eb1b564db58/lib/wit.js#L23-L29

https://github.com/telegraf/telegraf-wit/blob/94534277cdbb0ff787d11fc6d0999eb1b564db58/lib/wit.js#L40-L47

They now look like

return fetch(url, {
      method: 'GET',
      agent: this.opts.agent,
      headers: {
        'Authorization': `Bearer ${this.token}`,
        'Accept': 'application/json',
        'v': this.apiVersion
      }