mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
Merged revisions 83521 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83521 | senthil.kumaran | 2010-08-02 16:34:58 +0530 (Mon, 02 Aug 2010) | 3 lines Fix Issue8572 - httplib getheader() throws error instead of default ........
This commit is contained in:
parent
fc499bcfd3
commit
3357840baf
3 changed files with 44 additions and 3 deletions
|
@ -602,7 +602,11 @@ class HTTPResponse(io.RawIOBase):
|
|||
def getheader(self, name, default=None):
|
||||
if self.headers is None:
|
||||
raise ResponseNotReady()
|
||||
return ', '.join(self.headers.get_all(name, default))
|
||||
headers = self.headers.get_all(name) or default
|
||||
if isinstance(headers, str) or not hasattr(headers, '__iter__'):
|
||||
return headers
|
||||
else:
|
||||
return ', '.join(headers)
|
||||
|
||||
def getheaders(self):
|
||||
"""Return list of (header, value) tuples."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue