diff options
| author | Matthew Shao <me@matshao.com> | 2017-07-02 12:17:16 +0800 | 
|---|---|---|
| committer | Matthew Shao <me@matshao.com> | 2017-07-02 12:17:16 +0800 | 
| commit | d7bbfca167e56510eb4b9cf634f17a1cf0159a6a (patch) | |
| tree | ad26e9f04d63619899ae62413ba3acec5935ef32 | |
| parent | aad0b95cbe65e97574d49f3933002d347470d1ef (diff) | |
| download | mitmproxy-d7bbfca167e56510eb4b9cf634f17a1cf0159a6a.tar.gz mitmproxy-d7bbfca167e56510eb4b9cf634f17a1cf0159a6a.tar.bz2 mitmproxy-d7bbfca167e56510eb4b9cf634f17a1cf0159a6a.zip  | |
[web] Change the response format of GET /options.
| -rw-r--r-- | mitmproxy/optmanager.py | 9 | 
1 files changed, 4 insertions, 5 deletions
diff --git a/mitmproxy/optmanager.py b/mitmproxy/optmanager.py index 68c2f975..5692d751 100644 --- a/mitmproxy/optmanager.py +++ b/mitmproxy/optmanager.py @@ -413,22 +413,21 @@ def dump_dicts(opts):      """          Dumps the options into a list of dict object. -        Return: A list like: [ { name: "anticache", type: "bool", default: false, value: true, help: "help text"} ] +        Return: A list like: { "anticache": { type: "bool", default: false, value: true, help: "help text"} }      """ -    options_list = [] +    options_dict = {}      for k in sorted(opts.keys()):          o = opts._options[k]          t = typecheck.typespec_to_str(o.typespec)          option = { -            'name': k,              'type': t,              'default': o.default,              'value': o.current(),              'help': o.help,              'choices': o.choices          } -        options_list.append(option) -    return options_list +        options_dict[k] = option +    return options_dict  def parse(text):  | 
