From: Ricardo Marques Date: Mon, 1 Oct 2018 10:47:38 +0000 (+0100) Subject: mgr/dashboard: Check content-type before decode json response X-Git-Tag: v14.0.1~120^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=731dcefbeba2affca186d8b5c541ab95e3dedd26;p=ceph.git mgr/dashboard: Check content-type before decode json response Signed-off-by: Ricardo Marques --- diff --git a/qa/tasks/mgr/dashboard/helper.py b/qa/tasks/mgr/dashboard/helper.py index 025665be4f4c..c22ffacfb58c 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: