Add POST /options RESTful API for mitmweb.

This commit is contained in:
Matthew Shao 2017-06-23 10:44:09 +08:00
parent 9687d67601
commit ab162361a1

View File

@ -443,6 +443,14 @@ class Options(RequestHandler):
def get(self): def get(self):
self.write(optmanager.dump_dicts(self.master.options)) 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): class Application(tornado.web.Application):
def __init__(self, master, debug): def __init__(self, master, debug):