Skip to content

Commit 44be256

Browse files
committed
replace deprecated cgi module with EmailMessage.get_content_type
1 parent 47c7415 commit 44be256

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cryptojwt/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import base64
2-
import cgi
2+
from email.message import EmailMessage
33
import functools
44
import importlib
55
import json
@@ -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)