Skip to content

replace cgi #139

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Merged
merged 3 commits into from
May 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/cryptojwt/utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import base64
import cgi
import functools
import importlib
import json
import re
import struct
import warnings
from binascii import unhexlify
from email.message import EmailMessage
from typing import List

from cryptojwt.exception import BadSyntax
Expand Down Expand Up @@ -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