Skip to content

Commit

Permalink
Add set_proxy_auth to client initialization if proxy auth is required
Browse files Browse the repository at this point in the history
  • Loading branch information
unavailabl3 committed Nov 7, 2019
1 parent da31cd1 commit 0d0ea03
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/telegram/bot/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def error_for_response(response)

def initialize(token = nil, username = nil, **options)
@client = HTTPClient.new
if ENV['HTTP_PROXY']
@client.set_proxy_auth(ENV['HTTP_PROXY_USER'], ENV['HTTP_PROXY_PASSWORD'])
end
@token = token || options[:token]
@username = username || options[:username]
@base_uri = format(URL_TEMPLATE, token: self.token)
Expand Down

0 comments on commit 0d0ea03

Please sign in to comment.