mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-03 08:35:32 +00:00
[networking] Fix POST requests with zero-length payloads (#7648)
Bugfix for 227bf1a33b
Authored by: bashonly
This commit is contained in:
@ -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'}
|
||||
|
Reference in New Issue
Block a user