From b36283d47cc7b17f3c4508579b6b465268f607a0 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Apr 06 2016 09:50:23 +0000 Subject: mdapi-run: add content-type application/json This patch adds a content-type response of application/json to the json endpoints. Fixes: #23 Signed-off-by: Patrick Uiterwijk --- diff --git a/mdapi/__init__.py b/mdapi/__init__.py index e21528e..beeddac 100644 --- a/mdapi/__init__.py +++ b/mdapi/__init__.py @@ -179,7 +179,8 @@ def get_pkg(request): if pretty: args = dict(sort_keys=True, indent=4, separators=(',', ': ')) - return web.Response(body=json.dumps(output, **args).encode('utf-8')) + return web.Response(body=json.dumps(output, **args).encode('utf-8'), + content_type='application/json') @asyncio.coroutine @@ -208,7 +209,8 @@ def get_pkg_files(request): if pretty: args = dict(sort_keys=True, indent=4, separators=(',', ': ')) - return web.Response(body=json.dumps(output, **args).encode('utf-8')) + return web.Response(body=json.dumps(output, **args).encode('utf-8'), + content_type='application/json') @asyncio.coroutine @@ -237,7 +239,8 @@ def get_pkg_changelog(request): if pretty: args = dict(sort_keys=True, indent=4, separators=(',', ': ')) - return web.Response(body=json.dumps(output, **args).encode('utf-8')) + return web.Response(body=json.dumps(output, **args).encode('utf-8'), + content_type='application/json') @asyncio.coroutine @@ -256,7 +259,8 @@ def list_branches(request): if pretty: args = dict(sort_keys=True, indent=4, separators=(',', ': ')) - return web.Response(body=json.dumps(output, **args).encode('utf-8')) + return web.Response(body=json.dumps(output, **args).encode('utf-8'), + content_type='application/json') def process_dep(request, action): @@ -278,7 +282,8 @@ def process_dep(request, action): if pretty: args = dict(sort_keys=True, indent=4, separators=(',', ': ')) - return web.Response(body=json.dumps(output, **args).encode('utf-8')) + return web.Response(body=json.dumps(output, **args).encode('utf-8'), + content_type='application/json') @asyncio.coroutine