]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Check content-type before decode json response 24350/head
authorRicardo Marques <rimarques@suse.com>
Mon, 1 Oct 2018 10:47:38 +0000 (11:47 +0100)
committerRicardo Marques <rimarques@suse.com>
Mon, 1 Oct 2018 10:47:38 +0000 (11:47 +0100)
Signed-off-by: Ricardo Marques <rimarques@suse.com>
qa/tasks/mgr/dashboard/helper.py

index 025665be4f4c9a3ff319b2d3ad0bf83eda15392e..c22ffacfb58c8a139e41f26503fabf9f4c5a5d0f 100644 (file)
@@ -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: