chg: [api] default content-type is set to JSON

pull/1/head
Alexandre Dulaunoy 2020-01-06 16:01:33 +01:00
parent d9897caf61
commit ce71307801
1 changed files with 10 additions and 0 deletions

View File

@ -8,6 +8,11 @@ import json
class Query(tornado.web.RequestHandler): class Query(tornado.web.RequestHandler):
def prepare(self):
header = "Content-Type"
body = "application/json"
self.set_header(header, body)
def post(self): def post(self):
query = json_decode(self.request.body) query = json_decode(self.request.body)
if 'uuid' in query: if 'uuid' in query:
@ -26,6 +31,11 @@ class Query(tornado.web.RequestHandler):
class Get(tornado.web.RequestHandler): class Get(tornado.web.RequestHandler):
def prepare(self):
header = "Content-Type"
body = "application/json"
self.set_header(header, body)
def get(self, uuid): def get(self, uuid):
if uuid in tai_full: if uuid in tai_full:
result = tai_full[uuid] result = tai_full[uuid]