Skip to content

Commit 7065213

Browse files
authored
Merge pull request #139 from jschlyter/replace_cgi
replace cgi
2 parents 4fb4513 + d3a66f4 commit 7065213

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cryptojwt/utils.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import base64
2-
import cgi
32
import functools
43
import importlib
54
import json
65
import re
76
import struct
87
import warnings
98
from binascii import unhexlify
9+
from email.message import EmailMessage
1010
from typing import List
1111

1212
from cryptojwt.exception import BadSyntax
@@ -269,5 +269,7 @@ def httpc_params_loader(httpc_params):
269269

270270
def check_content_type(content_type, mime_type):
271271
"""Return True if the content type contains the MIME type"""
272-
mt, _ = cgi.parse_header(content_type)
272+
msg = EmailMessage()
273+
msg["content-type"] = content_type
274+
mt = msg.get_content_type()
273275
return mime_type == mt

0 commit comments

Comments
 (0)