Skip to content

Commit

Permalink
fix(HttpClient): use a copy of default headers to prevent side effect
Browse files Browse the repository at this point in the history
  • Loading branch information
giuseppeambrosio97 committed Dec 30, 2024
1 parent 0b51229 commit 69dddbd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions focoos/utils/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get(
Response: The response object from the requests library.
"""
url = f"{self.host_url}/{path}"
headers = self.default_headers
headers = self.default_headers.copy()
if extra_headers:
headers.update(extra_headers)
return requests.get(url, headers=headers, params=params, stream=stream)
Expand All @@ -111,7 +111,7 @@ def post(
Response: The response object from the requests library.
"""
url = f"{self.host_url}/{path}"
headers = self.default_headers
headers = self.default_headers.copy()
if extra_headers:
headers.update(extra_headers)
return requests.post(url, headers=headers, json=data, files=files)
Expand All @@ -128,7 +128,7 @@ def delete(self, path: str, extra_headers: Optional[dict] = None):
Response: The response object from the requests library.
"""
url = f"{self.host_url}/{path}"
headers = self.default_headers
headers = self.default_headers.copy()
if extra_headers:
headers.update(extra_headers)
return requests.delete(url, headers=headers)
Expand Down

0 comments on commit 69dddbd

Please sign in to comment.