[utils] HTTPHeaderDict: Fix __ior__ (#16930)

Authored by: doe1080
This commit is contained in:
doe1080 2026-06-11 23:43:24 +09:00 committed by GitHub
parent e47691215f
commit cb309b3293
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -2172,6 +2172,10 @@ Line 1
headers6 = HTTPHeaderDict(a=1, b=2) headers6 = HTTPHeaderDict(a=1, b=2)
self.assertEqual(pickle.loads(pickle.dumps(headers6)), headers6) 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): 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)
assert extract_basic_auth('http://foo.bar') == ('http://foo.bar', None) assert extract_basic_auth('http://foo.bar') == ('http://foo.bar', None)

View File

@ -64,7 +64,7 @@ class HTTPHeaderDict(dict):
other = other.sensitive() other = other.sensitive()
if isinstance(other, dict): if isinstance(other, dict):
self.update(other) self.update(other)
return return self
return NotImplemented return NotImplemented
def __or__(self, other, /) -> typing.Self: def __or__(self, other, /) -> typing.Self: