aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/contentviews/urlencoded.py
blob: e35bbdb7acca9528b86578dfc908f9715ceaf845 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from mitmproxy.net.http import url
from . import base


class ViewURLEncoded(base.View):
    name = "URL-encoded"
    content_types = ["application/x-www-form-urlencoded"]

    def __call__(self, data, **metadata):
        try:
            data = data.decode("ascii", "strict")
        except ValueError:
            return None
        d = url.decode(data)
        return "URLEncoded form", base.format_pairs(d)