aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Shao <me@matshao.com>2017-06-23 10:44:09 +0800
committerMatthew Shao <me@matshao.com>2017-06-23 10:44:09 +0800
commitab162361a1fe6d773807caa6071d49bdcf68b612 (patch)
tree960573af2a3d3bf9ff65112e031e2a023bcbd711
parent9687d676012379f5875331423fbbbe33fcd63434 (diff)
downloadmitmproxy-ab162361a1fe6d773807caa6071d49bdcf68b612.tar.gz
mitmproxy-ab162361a1fe6d773807caa6071d49bdcf68b612.tar.bz2
mitmproxy-ab162361a1fe6d773807caa6071d49bdcf68b612.zip
Add POST /options RESTful API for mitmweb.
-rw-r--r--mitmproxy/tools/web/app.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/mitmproxy/tools/web/app.py b/mitmproxy/tools/web/app.py
index ae542dc5..ad8e5d2a 100644
--- a/mitmproxy/tools/web/app.py
+++ b/mitmproxy/tools/web/app.py
@@ -443,6 +443,14 @@ class Options(RequestHandler):
def get(self):
self.write(optmanager.dump_dicts(self.master.options))
+ def put(self):
+ update = self.json
+ try:
+ self.master.options.update(**update)
+ except (KeyError, TypeError) as err:
+ raise APIError(400, "{}".format(err))
+
+
class Application(tornado.web.Application):
def __init__(self, master, debug):