Browse Source

Fixed exception caused in verify when response has no content-type set

Steven Smith 9 years ago
parent
commit
cfdbc6a4cd
1 changed files with 7 additions and 1 deletions
  1. 7 1
      toolset/benchmark/test_types/verifications.py

+ 7 - 1
toolset/benchmark/test_types/verifications.py

@@ -60,7 +60,13 @@ def verify_headers(headers, url, should_be='json'):
 
     content_type = headers.get('Content-Type', None)
 
-    if content_type.lower() == includes_charset:
+    if content_type is None:
+        problems.append(
+            ('warn',
+             'No content encoding found, expected \"%s\"' % (
+                 expected_type),
+             url))
+    elif content_type.lower() == includes_charset:
         problems.append(
             ('warn',
              ("Content encoding found \"%s\" where \"%s\" is acceptable.\n"