diff options
Diffstat (limited to 'netlib')
-rw-r--r-- | netlib/http/cookies.py | 4 | ||||
-rw-r--r-- | netlib/http/message.py | 2 | ||||
-rw-r--r-- | netlib/multidict.py | 14 |
3 files changed, 14 insertions, 6 deletions
diff --git a/netlib/http/cookies.py b/netlib/http/cookies.py index c5ac4591..88c76870 100644 --- a/netlib/http/cookies.py +++ b/netlib/http/cookies.py @@ -169,8 +169,8 @@ def parse_set_cookie_headers(headers): class CookieAttrs(ImmutableMultiDict): @staticmethod - def _kconv(v): - return v.lower() + def _kconv(key): + return key.lower() @staticmethod def _reduce_values(values): diff --git a/netlib/http/message.py b/netlib/http/message.py index 3c731ea6..db4054b1 100644 --- a/netlib/http/message.py +++ b/netlib/http/message.py @@ -279,7 +279,7 @@ class MultiDictView(MultiDict): """ def __init__(self, attr, message): - if False: + if False: # pragma: no cover # We do not want to call the parent constructor here as that # would cause an unnecessary parse/unparse pass. # This is here to silence linters. Message diff --git a/netlib/multidict.py b/netlib/multidict.py index 32d5bfc2..a359d46b 100644 --- a/netlib/multidict.py +++ b/netlib/multidict.py @@ -35,12 +35,20 @@ class MultiDict(MutableMapping, Serializable): @staticmethod @abstractmethod def _reduce_values(values): - pass + """ + If a user accesses multidict["foo"], this method + reduces all values for "foo" to a single value that is returned. + For example, HTTP headers are folded, whereas we will just take + the first cookie we found with that name. + """ @staticmethod @abstractmethod - def _kconv(v): - pass + def _kconv(key): + """ + This method converts a key to its canonical representation. + For example, HTTP headers are case-insensitive, so this method returns key.lower(). + """ def __getitem__(self, key): values = self.get_all(key) |