text-html type is absent in TXT_ENC
If we get response with 404 status code and this response
contains in headers "content-type: text/html", NotFound
exception isn't raised.
Add 'text/html' type of content and convert value of
this parameter to lower case.
Change-Id: I632701f43219fa6c0efc6e95bf6007cb0a3ff0c2
Closes-Bug: #1269712
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 9aca2ff..afc7a17 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -458,18 +458,17 @@
if resp.status < 400:
return
- JSON_ENC = ['application/json; charset=UTF-8', 'application/json',
- 'application/json; charset=utf-8']
+ JSON_ENC = ['application/json', 'application/json; charset=utf-8']
# NOTE(mtreinish): This is for compatibility with Glance and swift
# APIs. These are the return content types that Glance api v1
# (and occasionally swift) are using.
- TXT_ENC = ['text/plain', 'text/plain; charset=UTF-8',
- 'text/html; charset=UTF-8', 'text/plain; charset=utf-8']
- XML_ENC = ['application/xml', 'application/xml; charset=UTF-8']
+ TXT_ENC = ['text/plain', 'text/html', 'text/html; charset=utf-8',
+ 'text/plain; charset=utf-8']
+ XML_ENC = ['application/xml', 'application/xml; charset=utf-8']
- if ctype in JSON_ENC or ctype in XML_ENC:
+ if ctype.lower() in JSON_ENC or ctype.lower() in XML_ENC:
parse_resp = True
- elif ctype in TXT_ENC:
+ elif ctype.lower() in TXT_ENC:
parse_resp = False
else:
raise exceptions.RestClientException(str(resp.status))