From cb309b3293c9919cfb55f5d9ffa2c8c109a5f1eb Mon Sep 17 00:00:00 2001 From: doe1080 <98906116+doe1080@users.noreply.github.com> Date: Thu, 11 Jun 2026 23:43:24 +0900 Subject: [PATCH] [utils] `HTTPHeaderDict`: Fix `__ior__` (#16930) Authored by: doe1080 --- test/test_utils.py | 4 ++++ yt_dlp/utils/networking.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test_utils.py b/test/test_utils.py index cd0fb0f2e9..8f86d151b2 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -2172,6 +2172,10 @@ Line 1 headers6 = HTTPHeaderDict(a=1, b=2) self.assertEqual(pickle.loads(pickle.dumps(headers6)), headers6) + headers7 = HTTPHeaderDict() + headers7 |= {'X-dlp': 'data'} + self.assertEqual(headers7.sensitive(), {'X-dlp': '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) diff --git a/yt_dlp/utils/networking.py b/yt_dlp/utils/networking.py index 32c7acdb14..33cca412dc 100644 --- a/yt_dlp/utils/networking.py +++ b/yt_dlp/utils/networking.py @@ -64,7 +64,7 @@ class HTTPHeaderDict(dict): other = other.sensitive() if isinstance(other, dict): self.update(other) - return + return self return NotImplemented def __or__(self, other, /) -> typing.Self: