diff --git a/connexion/lifecycle.py b/connexion/lifecycle.py index 0a6c177a1..b86de4e93 100644 --- a/connexion/lifecycle.py +++ b/connexion/lifecycle.py @@ -20,7 +20,10 @@ def __init__(self, self.json_getter = json_getter self.files = files self.context = context if context is not None else {} - self.content_type = self.headers.get("Content-Type", "") + + @property + def content_type(self): + return self.headers.get("Content-Type") @property def json(self): diff --git a/connexion/utils.py b/connexion/utils.py index f739540d4..67d970545 100644 --- a/connexion/utils.py +++ b/connexion/utils.py @@ -118,7 +118,7 @@ def is_form_mimetype(mimetype): try: mimetype = mimetype.split(";")[0] maintype, subtype = mimetype.split('/') # type: str, str - except ValueError: + except (ValueError, AttributeError): return False multipart = maintype == 'multipart' and subtype.startswith("form-data") @@ -133,7 +133,7 @@ def is_json_mimetype(mimetype): """ try: maintype, subtype = mimetype.split('/') # type: str, str - except ValueError: + except (ValueError, AttributeError): return False return maintype == 'application' and (subtype == 'json' or subtype.endswith('+json'))