Fix return content-type to be JSON

Bonus side-effect: this patch makes tests passing again! \o/

Change-Id: I34795b8cdc4e17040bbb0b7f67a076885b76304f
Story: 2002789
Task:  22674
This commit is contained in:
Ilya Etingof 2018-07-04 17:55:06 +02:00
parent 8ee4747ed5
commit 3211a9ba68

View File

@ -78,9 +78,13 @@ def returns_json(decorated_func):
def decorator(*args, **kwargs): def decorator(*args, **kwargs):
response = decorated_func(*args, **kwargs) response = decorated_func(*args, **kwargs)
if isinstance(response, flask.Response): if isinstance(response, flask.Response):
return flask.Response(response, content_type='application/json')
else:
return response return response
if isinstance(response, tuple):
contents, status = response
else:
contents, status = response, 200
return flask.Response(response=contents, status=status,
content_type='application/json')
return decorator return decorator