Detect invalid settings data to persist (not a dict), send 400
This commit is contained in:
1 parent
72898360f3
commit
ccc3c4ef32
1 file changed
+4
@@ -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()
|
||||
|
||||
|
||||
Reference in new issue
Block a user