def cookies(self) -> multidict.MultiDictView: """ The request cookies. An empty :py:class:`~mitmproxy.net.multidict.MultiDictView` object if the cookie monster ate them all. """ return multidict.MultiDictView(self._get_cookies, self._set_cookies)
def cookies(self) -> multidict.MultiDictView[str, str]: """ The request cookies. For the most part, this behaves like a dictionary. Modifications to the MultiDictView update `Request.headers`, and vice versa. """ return multidict.MultiDictView(self._get_cookies, self._set_cookies)
def query(self) -> multidict.MultiDictView[str, str]: """ The request query as a mutable mapping view on the request's path. For the most part, this behaves like a dictionary. Modifications to the MultiDictView update `Request.path`, and vice versa. """ return multidict.MultiDictView(self._get_query, self._set_query)
def query(self) -> multidict.MultiDictView: """ The request query string as an :py:class:`~mitmproxy.net.multidict.MultiDictView` object. """ return multidict.MultiDictView( self._get_query, self._set_query )
def test_copy(self): p = TParent() tv = multidict.MultiDictView(p.getter, p.setter) c = tv.copy() assert isinstance(c, multidict.MultiDict) assert tv.items() == c.items() c["foo"] = "bar" assert tv.items() != c.items()
def test_modify(self): p = TParent() tv = multidict.MultiDictView(p.getter, p.setter) assert len(tv) == 0 tv["a"] = "b" assert p.vals == (("a", "b"), ) tv["c"] = "b" assert p.vals == (("a", "b"), ("c", "b")) assert tv["a"] == "b"
def multipart_form(self): """ The multipart form data as an :py:class:`~mitmproxy.net.multidict.MultiDictView` object. An empty multidict.MultiDictView if the content-type indicates non-form data or the content could not be parsed. Key and value are bytes. """ return multidict.MultiDictView(self._get_multipart_form, self._set_multipart_form)
def urlencoded_form(self): """ The URL-encoded form data as an :py:class:`~mitmproxy.net.multidict.MultiDictView` object. An empty multidict.MultiDictView if the content-type indicates non-form data or the content could not be parsed. Starting with mitmproxy 1.0, key and value are strings. """ return multidict.MultiDictView(self._get_urlencoded_form, self._set_urlencoded_form)
def multipart_form(self) -> multidict.MultiDictView[bytes, bytes]: """ The multipart form data. If the content-type indicates non-form data or the form could not be parsed, this is set to an empty `MultiDictView`. Modifications to the MultiDictView update `Request.content`, and vice versa. """ return multidict.MultiDictView(self._get_multipart_form, self._set_multipart_form)
def urlencoded_form(self) -> multidict.MultiDictView[str, str]: """ The URL-encoded form data. If the content-type indicates non-form data or the form could not be parsed, this is set to an empty `MultiDictView`. Modifications to the MultiDictView update `Request.content`, and vice versa. """ return multidict.MultiDictView(self._get_urlencoded_form, self._set_urlencoded_form)
def cookies(self) -> multidict.MultiDictView: """ The response cookies. A possibly empty :py:class:`~mitmproxy.net.multidict.MultiDictView`, where the keys are cookie name strings, and values are (value, attr) tuples. Value is a string, and attr is an MultiDictView containing cookie attributes. Within attrs, unary attributes (e.g. HTTPOnly) are indicated by a Null value. Caveats: Updating the attr """ return multidict.MultiDictView(self._get_cookies, self._set_cookies)
def cookies( self ) -> multidict.MultiDictView[str, Tuple[str, multidict.MultiDict[ str, Optional[str]]]]: """ The response cookies. A possibly empty `MultiDictView`, where the keys are cookie name strings, and values are `(cookie value, attributes)` tuples. Within attributes, unary attributes (e.g. `HTTPOnly`) are indicated by a `None` value. Modifications to the MultiDictView update `Response.headers`, and vice versa. *Warning:* Changes to `attributes` will not be picked up unless you also reassign the `(cookie value, attributes)` tuple directly in the `MultiDictView`. """ return multidict.MultiDictView(self._get_cookies, self._set_cookies)