mirror of
https://github.com/python/cpython.git
synced 2025-11-12 07:02:33 +00:00
get_all(): We never returned failobj if we found no matching headers.
Fix that, and also make the docstring describe failobj.
This commit is contained in:
parent
93a6327adf
commit
9300a75c88
1 changed files with 4 additions and 0 deletions
|
|
@ -227,12 +227,16 @@ class Message:
|
||||||
These will be sorted in the order they appeared in the original
|
These will be sorted in the order they appeared in the original
|
||||||
message, and may contain duplicates. Any fields deleted and
|
message, and may contain duplicates. Any fields deleted and
|
||||||
re-inserted are alwyas appended to the header list.
|
re-inserted are alwyas appended to the header list.
|
||||||
|
|
||||||
|
If no such fields exist, failobj is returned (defaults to None).
|
||||||
"""
|
"""
|
||||||
values = []
|
values = []
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
for k, v in self._headers:
|
for k, v in self._headers:
|
||||||
if k.lower() == name:
|
if k.lower() == name:
|
||||||
values.append(v)
|
values.append(v)
|
||||||
|
if not values:
|
||||||
|
return failobj
|
||||||
return values
|
return values
|
||||||
|
|
||||||
def add_header(self, _name, _value, **_params):
|
def add_header(self, _name, _value, **_params):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue