diff options
-rw-r--r-- | netlib/http/semantics.py | 6 | ||||
-rw-r--r-- | test/http/test_semantics.py | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/netlib/http/semantics.py b/netlib/http/semantics.py index edf5fc07..5bb098a7 100644 --- a/netlib/http/semantics.py +++ b/netlib/http/semantics.py @@ -14,7 +14,7 @@ HDR_FORM_MULTIPART = "multipart/form-data" CONTENT_MISSING = 0 -class Headers(UserDict.DictMixin): +class Headers(object, UserDict.DictMixin): """ Header class which allows both convenient access to individual headers as well as direct access to the underlying raw data. Provides a full dictionary interface. @@ -135,7 +135,7 @@ class Headers(UserDict.DictMixin): def __ne__(self, other): return not self.__eq__(other) - def get_all(self, name, default=[]): + def get_all(self, name): """ Like :py:meth:`get`, but does not fold multiple headers into a single one. This is useful for Set-Cookie headers, which do not support folding. @@ -144,7 +144,7 @@ class Headers(UserDict.DictMixin): """ name = name.lower() values = [value for n, value in self.fields if n.lower() == name] - return values or default + return values def set_all(self, name, values): """ diff --git a/test/http/test_semantics.py b/test/http/test_semantics.py index 22fe992c..6dcbbe07 100644 --- a/test/http/test_semantics.py +++ b/test/http/test_semantics.py @@ -547,7 +547,7 @@ class TestHeaders(object): def test_get_all(self): headers = self._2host() assert headers.get_all("host") == ["example.com", "example.org"] - assert headers.get_all("accept", 42) is 42 + assert headers.get_all("accept") == [] def test_set_all(self): headers = semantics.Headers(Host="example.com") |