1 parent 4327066 commit 58ec2e4Copy full SHA for 58ec2e4
2 files changed
sentry_sdk/transport.py
@@ -19,7 +19,8 @@
19
20
21
def _make_pool(parsed_dsn, http_proxy, https_proxy, ca_certs):
22
- proxy = https_proxy if parsed_dsn == "https" else http_proxy
+ # Use http_proxy if scheme is https and https_proxy is not set
23
+ proxy = parsed_dsn.scheme == "https" and https_proxy or http_proxy
24
if not proxy:
25
proxy = getproxies().get(parsed_dsn.scheme)
26
tests/test_client.py
@@ -34,6 +34,28 @@ def test_transport_option(monkeypatch):
34
assert str(Client(transport=transport).dsn) == dsn
35
36
37
+def test_http_proxy(monkeypatch):
38
+ client = Client("https://foo@sentry.io/123", http_proxy="http://localhost/123")
39
+ assert client.transport._pool.proxy.scheme == "http"
40
+
41
+ client = Client(
42
+ "https://foo@sentry.io/123",
43
+ https_proxy="https://localhost/123",
44
+ http_proxy="http://localhost/123",
45
+ )
46
+ assert client.transport._pool.proxy.scheme == "https"
47
48
+ client = Client("http://foo@sentry.io/123", http_proxy="http://localhost/123")
49
50
51
52
+ "http://foo@sentry.io/123",
53
54
55
56
57
58
59
def test_simple_transport():
60
events = []
61
with Hub(Client(transport=events.append)):
0 commit comments