diff --git a/src/cryptojwt/utils.py b/src/cryptojwt/utils.py index 0d57f803..8471840f 100644 --- a/src/cryptojwt/utils.py +++ b/src/cryptojwt/utils.py @@ -1,5 +1,4 @@ import base64 -import cgi import functools import importlib import json @@ -7,6 +6,7 @@ import struct import warnings from binascii import unhexlify +from email.message import EmailMessage from typing import List from cryptojwt.exception import BadSyntax @@ -269,5 +269,7 @@ def httpc_params_loader(httpc_params): def check_content_type(content_type, mime_type): """Return True if the content type contains the MIME type""" - mt, _ = cgi.parse_header(content_type) + msg = EmailMessage() + msg["content-type"] = content_type + mt = msg.get_content_type() return mime_type == mt