aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_networking.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_networking.py')
-rw-r--r--test/test_networking.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_networking.py b/test/test_networking.py
index b60ed283b..3cf587a63 100644
--- a/test/test_networking.py
+++ b/test/test_networking.py
@@ -1280,6 +1280,17 @@ class TestRequest:
req.data = b'test3'
assert req.headers.get('Content-Type') == 'application/x-www-form-urlencoded'
+ def test_update_req(self):
+ req = Request('http://example.com')
+ assert req.data is None
+ assert req.method == 'GET'
+ assert 'Content-Type' not in req.headers
+ # Test that zero-byte payloads will be sent
+ req.update(data=b'')
+ assert req.data == b''
+ assert req.method == 'POST'
+ assert req.headers.get('Content-Type') == 'application/x-www-form-urlencoded'
+
def test_proxies(self):
req = Request(url='http://example.com', proxies={'http': 'http://127.0.0.1:8080'})
assert req.proxies == {'http': 'http://127.0.0.1:8080'}