http response is in json format

This commit is contained in:
Emmanuel Garette 2020-03-04 07:32:40 +01:00
parent 52824302d4
commit 299a9f52a0
1 changed files with 4 additions and 2 deletions

View File

@ -58,7 +58,8 @@ class extra_route_handler:
raise HTTPInternalServerError(reason=str(err)) raise HTTPInternalServerError(reason=str(err))
# await log.info_msg(kwargs['risotto_context'], # await log.info_msg(kwargs['risotto_context'],
# dict(request.match_info)) # dict(request.match_info))
return Response(text=dumps(returns)) return Response(text=dumps(returns),
content_type='application/json')
async def handle(request): async def handle(request):
@ -84,7 +85,8 @@ async def handle(request):
if get_config()['global']['debug']: if get_config()['global']['debug']:
print_exc() print_exc()
raise HTTPInternalServerError(reason=str(err)) raise HTTPInternalServerError(reason=str(err))
return Response(text=dumps({'response': text})) return Response(text=dumps({'response': text},
content_type='application/json'))
async def api(request, risotto_context): async def api(request, risotto_context):