From ab162361a1fe6d773807caa6071d49bdcf68b612 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Fri, 23 Jun 2017 10:44:09 +0800 Subject: [PATCH] Add POST /options RESTful API for mitmweb. --- mitmproxy/tools/web/app.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mitmproxy/tools/web/app.py b/mitmproxy/tools/web/app.py index ae542dc5d..ad8e5d2a1 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):