aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-07-17 09:54:41 +0530
committerShadab Zafar <dufferzafar0@gmail.com>2016-07-20 10:03:00 +0530
commitc84d0bd10bdaa5c70b519d16d3329be2a3b7ae8a (patch)
treeb241bf0b8db5e172518673b7461fbffe426b4d0e
parent0d478e71ee6f1c3e0c00fd546867e5237751f3ad (diff)
downloadmitmproxy-c84d0bd10bdaa5c70b519d16d3329be2a3b7ae8a.tar.gz
mitmproxy-c84d0bd10bdaa5c70b519d16d3329be2a3b7ae8a.tar.bz2
mitmproxy-c84d0bd10bdaa5c70b519d16d3329be2a3b7ae8a.zip
Add a url exporter
-rw-r--r--mitmproxy/flow/export.py4
-rw-r--r--test/mitmproxy/test_flow_export.py6
2 files changed, 10 insertions, 0 deletions
diff --git a/mitmproxy/flow/export.py b/mitmproxy/flow/export.py
index 476b1898..dbb0aad9 100644
--- a/mitmproxy/flow/export.py
+++ b/mitmproxy/flow/export.py
@@ -194,6 +194,10 @@ def locust_task(flow):
return task_code
+def url(flow):
+ return flow.request.url
+
+
EXPORTERS = [
("content", "c"),
("headers+content", "h"),
diff --git a/test/mitmproxy/test_flow_export.py b/test/mitmproxy/test_flow_export.py
index 41089a64..86ff937d 100644
--- a/test/mitmproxy/test_flow_export.py
+++ b/test/mitmproxy/test_flow_export.py
@@ -117,3 +117,9 @@ class TestIsJson():
headers = Headers(content_type="application/json")
j = export.is_json(headers, b'{"name": "example", "email": "example@example.com"}')
assert isinstance(j, dict)
+
+
+class TestURL():
+ def test_url(self):
+ flow = tutils.tflow()
+ assert export.url(flow) == "http://address:22/path"