diff --git a/airbyte_cdk/sources/streams/http/http_client.py b/airbyte_cdk/sources/streams/http/http_client.py index 9eae35494..bade96c9c 100644 --- a/airbyte_cdk/sources/streams/http/http_client.py +++ b/airbyte_cdk/sources/streams/http/http_client.py @@ -562,7 +562,7 @@ def send_request( env_settings = self._session.merge_environment_settings( url=request.url, - proxies=request_kwargs.get("proxies"), + proxies=request_kwargs.get("proxies", {}), stream=request_kwargs.get("stream"), verify=request_kwargs.get("verify"), cert=request_kwargs.get("cert"), diff --git a/unit_tests/sources/streams/http/test_http_client.py b/unit_tests/sources/streams/http/test_http_client.py index d628a83ce..3840c70e3 100644 --- a/unit_tests/sources/streams/http/test_http_client.py +++ b/unit_tests/sources/streams/http/test_http_client.py @@ -747,6 +747,20 @@ def test_given_different_headers_then_response_is_not_cached(requests_mock): assert second_response.json()["test"] == "second response" +def test_given_noproxy_for_another_url_when_send_request_then_do_not_break(requests_mock): + http_client = HttpClient(name="test", logger=MagicMock(), use_cache=True) + os.environ["no_proxy"] = "another.com" + requests_mock.register_uri( + "GET", + "https://google.com/", + json={"test": "a response"}, + ) + + x = http_client.send_request("GET", "https://google.com/", request_kwargs={}) + + assert x + + @patch.dict("os.environ", {"REQUESTS_CA_BUNDLE": "/path/to/ca-bundle.crt"}) def test_send_request_respects_environment_variables(): """Test that send_request respects REQUESTS_CA_BUNDLE environment variable."""