From 731dcefbeba2affca186d8b5c541ab95e3dedd26 Mon Sep 17 00:00:00 2001 From: Ricardo Marques Date: Mon, 1 Oct 2018 11:47:38 +0100 Subject: [PATCH] mgr/dashboard: Check content-type before decode json response Signed-off-by: Ricardo Marques --- qa/tasks/mgr/dashboard/helper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qa/tasks/mgr/dashboard/helper.py b/qa/tasks/mgr/dashboard/helper.py index 025665be4f4c9..c22ffacfb58c8 100644 --- a/qa/tasks/mgr/dashboard/helper.py +++ b/qa/tasks/mgr/dashboard/helper.py @@ -169,7 +169,8 @@ class DashboardTestCase(MgrTestCase): else: assert False try: - if cls._resp.text and cls._resp.text != "": + content_type = cls._resp.headers['content-type'] + if content_type == 'application/json' and cls._resp.text and cls._resp.text != "": return cls._resp.json() return cls._resp.text except ValueError as ex: -- 2.39.5