Skip to content

Commit 0bb36f3

Browse files
keelerm84saada
andauthored
fix: Pass through proxy user and password if present (#69)
Co-authored-by: saada <moodysaada@surgehq.ai>
1 parent 1d9b31c commit 0bb36f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/ld-eventsource/client.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ class Client
4949
# The default value for `reconnect_reset_interval` in {#initialize}.
5050
DEFAULT_RECONNECT_RESET_INTERVAL = 60
5151

52+
# The default HTTP method for requests.
53+
DEFAULT_HTTP_METHOD = "GET"
54+
5255
#
5356
# Creates a new SSE client.
5457
#
@@ -106,7 +109,7 @@ def initialize(uri,
106109
proxy: nil,
107110
logger: nil,
108111
socket_factory: nil,
109-
method: "GET",
112+
method: DEFAULT_HTTP_METHOD,
110113
payload: nil,
111114
retry_enabled: true,
112115
http_client_options: nil)
@@ -140,6 +143,8 @@ def initialize(uri,
140143
:proxy_address => @proxy.host,
141144
:proxy_port => @proxy.port,
142145
}
146+
base_http_client_options["proxy"][:proxy_username] = @proxy.user unless @proxy.user.nil?
147+
base_http_client_options["proxy"][:proxy_password] = @proxy.password unless @proxy.password.nil?
143148
end
144149

145150
options = http_client_options.is_a?(Hash) ? base_http_client_options.merge(http_client_options) : base_http_client_options

0 commit comments

Comments
 (0)