mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-05-12 17:48:49 +08:00
tests++
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user