-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Using MicroPython v1.24.1 on 2024-11-29; Raspberry Pi Pico W with RP2040
The trivial test program below works correctly on Python but fails on Micropython :
import requests
# test to demonstrate that micropython request incorrectly modifies caller's headers dict
headers = {}
response = requests.get(
url="http://www.google.com",
headers=headers,
data="string",
)
print(headers)
assert headers == {}, "requests returned changed headers to parent"
Fix is equally trivial but my github skills are limited.
After these lines:
micropython-lib/python-ecosys/requests/requests/__init__.py
Lines 47 to 48 in e4cf095
if headers is None: | |
headers = {} |
Add
else:
headers = headers.copy()
to take a local copy for subsequent use in requests().
Metadata
Metadata
Assignees
Labels
No labels