Patch #800236: add HTTPResponse.getheaders().
This commit is contained in:
parent
c473c99d16
commit
deacce2c87
|
@ -211,6 +211,10 @@ Get the contents of the header \var{name}, or \var{default} if there is no
|
|||
matching header.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getheaders}{}
|
||||
Return a list of (header, value) tuples. \versionadded{2.4}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{datadesc}{msg}
|
||||
A \class{mimetools.Message} instance containing the response headers.
|
||||
\end{datadesc}
|
||||
|
|
|
@ -493,6 +493,12 @@ class HTTPResponse:
|
|||
raise ResponseNotReady()
|
||||
return self.msg.getheader(name, default)
|
||||
|
||||
def getheaders(self):
|
||||
"""Return list of (header, value) tuples."""
|
||||
if self.msg is None:
|
||||
raise ResponseNotReady()
|
||||
return self.msg.items()
|
||||
|
||||
|
||||
class HTTPConnection:
|
||||
|
||||
|
|
Loading…
Reference in New Issue