From 67dc3ca95578d93aa8c3c24cff0fd520aefd0a4a Mon Sep 17 00:00:00 2001 From: Andrew Gadsby Date: Sun, 12 Jan 2025 13:27:04 +0000 Subject: [PATCH] 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 --- python-ecosys/requests/requests/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-ecosys/requests/requests/__init__.py b/python-ecosys/requests/requests/__init__.py index a9a183619..663a4f608 100644 --- a/python-ecosys/requests/requests/__init__.py +++ b/python-ecosys/requests/requests/__init__.py @@ -46,6 +46,8 @@ def request( ): if headers is None: headers = {} + else: + headers = headers.copy() # local copy so we don't extend caller's redirect = None # redirection url, None means no redirection chunked_data = data and getattr(data, "__next__", None) and not getattr(data, "__len__", None)