From 78bb8207d54efb7b321402dcea8116ee7a42f80a Mon Sep 17 00:00:00 2001 From: Jari Turkia Date: Thu, 12 Oct 2023 17:12:09 +0300 Subject: [PATCH] HTTP content-type isn't using charset --- openapi_core/unmarshalling/response/unmarshallers.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openapi_core/unmarshalling/response/unmarshallers.py b/openapi_core/unmarshalling/response/unmarshallers.py index ce88a753..780c2c71 100644 --- a/openapi_core/unmarshalling/response/unmarshallers.py +++ b/openapi_core/unmarshalling/response/unmarshallers.py @@ -63,9 +63,12 @@ def _unmarshal( except ResponseFinderError as exc: return ResponseUnmarshalResult(errors=[exc]) + # Drop optional "; charset=utf-8" + mimetype = response.mimetype.split(';')[0] + try: validated_data = self._get_data( - response.data, response.mimetype, operation_response + response.data, mimetype, operation_response ) except DataValidationError as exc: validated_data = None @@ -103,9 +106,12 @@ def _unmarshal_data( except ResponseFinderError as exc: return ResponseUnmarshalResult(errors=[exc]) + # Drop optional "; charset=utf-8" + mimetype = response.mimetype.split(';')[0] + try: validated = self._get_data( - response.data, response.mimetype, operation_response + response.data, mimetype, operation_response ) except DataValidationError as exc: validated = None