Detect invalid settings data to persist (not a dict), send 400
This commit is contained in:
parent
72898360f3
commit
ccc3c4ef32
1 changed files with 4 additions and 0 deletions
|
|
@ -256,6 +256,10 @@ def setSettings():
|
|||
except BadRequest:
|
||||
return make_response("Malformed JSON body in request", 400)
|
||||
|
||||
if not isinstance(data, dict):
|
||||
return make_response("Malformed request, need settings dictionary, "
|
||||
"got a {} instead: {!r}".format(type(data).__name__, data), 400)
|
||||
|
||||
_saveSettings(data)
|
||||
return getSettings()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue