chg: [api] return proper error if the query format is incorrect

pull/1/head
Alexandre Dulaunoy 2020-01-07 10:52:24 +01:00
parent f559c93c08
commit ef4660a92d
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 2 additions and 0 deletions

View File

@ -15,6 +15,8 @@ class Query(tornado.web.RequestHandler):
def post(self):
query = json_decode(self.request.body)
if not ('uuid' in query or 'name' in query):
return self.write(json.dumps("'error': 'Incorrect query format'"))
if 'uuid' in query:
if query['uuid'] in tai_full:
result = tai_full[query['uuid']]