From 3211a9ba68754790d9b7251c158aa3cb98aaa27c Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Wed, 4 Jul 2018 17:55:06 +0200 Subject: [PATCH] Fix return content-type to be JSON Bonus side-effect: this patch makes tests passing again! \o/ Change-Id: I34795b8cdc4e17040bbb0b7f67a076885b76304f Story: 2002789 Task: 22674 --- sushy_tools/emulator/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sushy_tools/emulator/main.py b/sushy_tools/emulator/main.py index cd2b58ea..c66ad8d4 100755 --- a/sushy_tools/emulator/main.py +++ b/sushy_tools/emulator/main.py @@ -78,9 +78,13 @@ def returns_json(decorated_func): def decorator(*args, **kwargs): response = decorated_func(*args, **kwargs) if isinstance(response, flask.Response): - return flask.Response(response, content_type='application/json') - else: 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