Skip to content

Commit

Permalink
fix: Error in meltano add when using env var proxies (e.g. `HTTP_PR…
Browse files Browse the repository at this point in the history
…OXY`) (meltano#7347)
  • Loading branch information
edgarrmondragon committed Feb 24, 2023
1 parent 39a10d5 commit 4af03b2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/meltano/core/hub/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def _get(self, url: str) -> requests.Response:
prep = self._build_request("GET", url)
settings = self.session.merge_environment_settings(
prep.url,
None,
{},
None,
None,
None,
Expand Down
21 changes: 21 additions & 0 deletions tests/meltano/core/hub/test_meltano_hub_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,24 @@ def send(self, request, **kwargs):
monkeypatch.setenv("REQUESTS_CA_BUNDLE", "/path/to/ca.pem")
hub._get(mock_url)
assert send_kwargs["verify"] == "/path/to/ca.pem"

def test_custom_proxy(self, project, monkeypatch):
send_kwargs = {}

class _Adapter(BaseAdapter):
def send(self, request, **kwargs):
nonlocal send_kwargs
send_kwargs = kwargs

response = Response()
response._content = b'{"name": "tap-mock", "namespace": "tap_mock"}'
response.status_code = 200
return response

mock_url = "hub://meltano"
hub = project.hub_service
hub.session.mount(mock_url, _Adapter())

monkeypatch.setenv("HTTPS_PROXY", "https://www.example.com:3128/")
hub._get(mock_url)
assert send_kwargs["proxies"] == {"https": "https://www.example.com:3128/"}

0 comments on commit 4af03b2

Please sign in to comment.