Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions openapi/templates/rest.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,13 @@ class RESTClientObject:
if self.configuration.proxy:
client_kwargs["proxy"] = self.configuration.proxy

existing_headers = client_kwargs.pop("headers")
if self.configuration.proxy_headers:
for key, value in self.configuration.proxy_headers.items():
existing_headers[key] = value
client_kwargs["headers"] = existing_headers
# httpx doesn't have a dedicated `proxy_headers` kwarg the way
# urllib3 does — merging them into the default request headers
# is the closest equivalent.
existing_headers = dict(client_kwargs.get("headers") or {})
existing_headers.update(self.configuration.proxy_headers)
client_kwargs["headers"] = existing_headers

if self.configuration.retries is not None:
transport = httpx.HTTPTransport(retries=self.configuration.retries, limits=limits)
Expand Down
10 changes: 6 additions & 4 deletions src/rapidata/api_client/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,13 @@ def _get_session_defaults(self):
if self.configuration.proxy:
client_kwargs["proxy"] = self.configuration.proxy

existing_headers = client_kwargs.pop("headers")
if self.configuration.proxy_headers:
for key, value in self.configuration.proxy_headers.items():
existing_headers[key] = value
client_kwargs["headers"] = existing_headers
# httpx doesn't have a dedicated `proxy_headers` kwarg the way
# urllib3 does — merging them into the default request headers
# is the closest equivalent.
existing_headers = dict(client_kwargs.get("headers") or {})
existing_headers.update(self.configuration.proxy_headers)
client_kwargs["headers"] = existing_headers

if self.configuration.retries is not None:
transport = httpx.HTTPTransport(retries=self.configuration.retries, limits=limits)
Expand Down
Loading