Skip to content
Snippets Groups Projects
Commit ec056872 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Fix for expected content-type in fetch method

parent 4ef0560a
No related branches found
No related tags found
No related merge requests found
Pipeline #2193 passed
...@@ -22,7 +22,7 @@ def fetch(url : str, expected_content_type : str = None) -> requests.Response: ...@@ -22,7 +22,7 @@ def fetch(url : str, expected_content_type : str = None) -> requests.Response:
logging.error(errorMessage) logging.error(errorMessage)
raise ValueError(errorMessage) raise ValueError(errorMessage)
if expected_content_type: if expected_content_type:
if r.headers['Content-Type'] != expected_content_type: if not expected_content_type in r.headers['Content-Type']:
errorMessage = f"Unexpected content type retrieving {url}. Expected {expected_content_type}, got {r.headers['Content-Type']}" errorMessage = f"Unexpected content type retrieving {url}. Expected {expected_content_type}, got {r.headers['Content-Type']}"
logging.error(errorMessage) logging.error(errorMessage)
raise ValueError(errorMessage) raise ValueError(errorMessage)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment