aboutsummaryrefslogtreecommitdiff
path: root/test/test_utils.py
diff options
context:
space:
mode:
authorcoletdjnz <coletdjnz@protonmail.com>2023-12-20 19:15:38 +1300
committerGitHub <noreply@github.com>2023-12-20 19:15:38 +1300
commit196eb0fe77b78e2e5ca02c506c3837c2b1a7964c (patch)
tree924856c35ebb39015baefdc5c10799541d12cc83 /test/test_utils.py
parentdb8b4edc7d0bd27da462f6fe82ff6e13e3d68a04 (diff)
[networking] Strip whitespace around header values (#8802)
Fixes https://github.com/yt-dlp/yt-dlp/issues/8729 Authored by: coletdjnz
Diffstat (limited to 'test/test_utils.py')
-rw-r--r--test/test_utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 100f11788..6c8571f98 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -2370,6 +2370,11 @@ Line 1
headers4 = HTTPHeaderDict({'ytdl-test': 'data;'})
self.assertEqual(set(headers4.items()), {('Ytdl-Test', 'data;')})
+ # common mistake: strip whitespace from values
+ # https://github.com/yt-dlp/yt-dlp/issues/8729
+ headers5 = HTTPHeaderDict({'ytdl-test': ' data; '})
+ self.assertEqual(set(headers5.items()), {('Ytdl-Test', 'data;')})
+
def test_extract_basic_auth(self):
assert extract_basic_auth('http://:foo.bar') == ('http://:foo.bar', None)
assert extract_basic_auth('http://foo.bar') == ('http://foo.bar', None)