mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
[web] Change the response format of GET /options.
This commit is contained in:
parent
aad0b95cbe
commit
d7bbfca167
@ -413,22 +413,21 @@ def dump_dicts(opts):
|
|||||||
"""
|
"""
|
||||||
Dumps the options into a list of dict object.
|
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()):
|
for k in sorted(opts.keys()):
|
||||||
o = opts._options[k]
|
o = opts._options[k]
|
||||||
t = typecheck.typespec_to_str(o.typespec)
|
t = typecheck.typespec_to_str(o.typespec)
|
||||||
option = {
|
option = {
|
||||||
'name': k,
|
|
||||||
'type': t,
|
'type': t,
|
||||||
'default': o.default,
|
'default': o.default,
|
||||||
'value': o.current(),
|
'value': o.current(),
|
||||||
'help': o.help,
|
'help': o.help,
|
||||||
'choices': o.choices
|
'choices': o.choices
|
||||||
}
|
}
|
||||||
options_list.append(option)
|
options_dict[k] = option
|
||||||
return options_list
|
return options_dict
|
||||||
|
|
||||||
|
|
||||||
def parse(text):
|
def parse(text):
|
||||||
|
Loading…
Reference in New Issue
Block a user