Skip to content

Commit 67dc3ca

Browse files
authored
Update __init__.py to prevent changes to caller's headers dict
Need to take a local copy of any headers passed in to requests() otherwise the caller's list gets incorrectly extended or modified. Signed-off-by: Andrew Gadsby <andrew@gadsby.me.uk>
1 parent e4cf095 commit 67dc3ca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

python-ecosys/requests/requests/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def request(
4646
):
4747
if headers is None:
4848
headers = {}
49+
else:
50+
headers = headers.copy() # local copy so we don't extend caller's
4951

5052
redirect = None # redirection url, None means no redirection
5153
chunked_data = data and getattr(data, "__next__", None) and not getattr(data, "__len__", None)

0 commit comments

Comments
 (0)