diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-03-11 16:44:55 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-03-11 16:44:55 +0100 |
commit | 1bfc27c3f644c7edd20b7911209dc072ba9965ad (patch) | |
tree | 800f27e7dc510ab6ed36dc8eb6e98f6152bc3bd9 /examples | |
parent | c1c3fe3c8855d005bb951f844455a66e43213604 (diff) | |
parent | 5a1c3c4ad818df9355bb71326bc810e4ce361cb6 (diff) | |
download | mitmproxy-1bfc27c3f644c7edd20b7911209dc072ba9965ad.tar.gz mitmproxy-1bfc27c3f644c7edd20b7911209dc072ba9965ad.tar.bz2 mitmproxy-1bfc27c3f644c7edd20b7911209dc072ba9965ad.zip |
Merge pull request #1008 from dufferzafar/test-examples
Some tests for examples
Diffstat (limited to 'examples')
-rw-r--r-- | examples/__init__.py | 0 | ||||
-rw-r--r-- | examples/iframe_injector.py | 2 | ||||
-rw-r--r-- | examples/modify_form.py | 6 | ||||
-rw-r--r-- | examples/modify_querystring.py | 5 |
4 files changed, 6 insertions, 7 deletions
diff --git a/examples/__init__.py b/examples/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/examples/__init__.py +++ /dev/null diff --git a/examples/iframe_injector.py b/examples/iframe_injector.py index fc38b136..ad844f19 100644 --- a/examples/iframe_injector.py +++ b/examples/iframe_injector.py @@ -14,7 +14,7 @@ def response(context, flow): if flow.request.host in context.iframe_url: return with decoded(flow.response): # Remove content encoding (gzip, ...) - html = BeautifulSoup(flow.response.content) + html = BeautifulSoup(flow.response.content, "lxml") if html.body: iframe = html.new_tag( "iframe", diff --git a/examples/modify_form.py b/examples/modify_form.py index 3e9d15c0..86188781 100644 --- a/examples/modify_form.py +++ b/examples/modify_form.py @@ -1,5 +1,5 @@ def request(context, flow): - if "application/x-www-form-urlencoded" in flow.request.headers.get("content-type", ""): - form = flow.request.get_form_urlencoded() + form = flow.request.urlencoded_form + if form is not None: form["mitmproxy"] = ["rocks"] - flow.request.set_form_urlencoded(form) + flow.request.urlencoded_form = form diff --git a/examples/modify_querystring.py b/examples/modify_querystring.py index 7f31a48f..d682df69 100644 --- a/examples/modify_querystring.py +++ b/examples/modify_querystring.py @@ -1,6 +1,5 @@ - def request(context, flow): - q = flow.request.get_query() + q = flow.request.query if q: q["mitmproxy"] = ["rocks"] - flow.request.set_query(q) + flow.request.query = q |