Skip to content

Commit 8a01e33

Browse files
maxi297octavia-squidington-iii
andauthored
fix: noproxy that breaks regression tests (#777)
Co-authored-by: octavia-squidington-iii <contact@airbyte.com>
1 parent 25132b6 commit 8a01e33

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

airbyte_cdk/sources/streams/http/http_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ def send_request(
562562

563563
env_settings = self._session.merge_environment_settings(
564564
url=request.url,
565-
proxies=request_kwargs.get("proxies"),
565+
proxies=request_kwargs.get("proxies", {}),
566566
stream=request_kwargs.get("stream"),
567567
verify=request_kwargs.get("verify"),
568568
cert=request_kwargs.get("cert"),

unit_tests/sources/streams/http/test_http_client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,20 @@ def test_given_different_headers_then_response_is_not_cached(requests_mock):
747747
assert second_response.json()["test"] == "second response"
748748

749749

750+
def test_given_noproxy_for_another_url_when_send_request_then_do_not_break(requests_mock):
751+
http_client = HttpClient(name="test", logger=MagicMock(), use_cache=True)
752+
os.environ["no_proxy"] = "another.com"
753+
requests_mock.register_uri(
754+
"GET",
755+
"https://google.com/",
756+
json={"test": "a response"},
757+
)
758+
759+
x = http_client.send_request("GET", "https://google.com/", request_kwargs={})
760+
761+
assert x
762+
763+
750764
@patch.dict("os.environ", {"REQUESTS_CA_BUNDLE": "/path/to/ca-bundle.crt"})
751765
def test_send_request_respects_environment_variables():
752766
"""Test that send_request respects REQUESTS_CA_BUNDLE environment variable."""

0 commit comments

Comments
 (0)