mirror of
https://github.com/correl/tornado-openapi3.git
synced 2024-11-24 11:09:57 +00:00
10 lines
311 B
Python
10 lines
311 B
Python
import ietfparse.headers
|
|
|
|
|
|
def parse_mimetype(content_type: str) -> str:
|
|
parsed = ietfparse.headers.parse_content_type(content_type)
|
|
return "{}/{}{}".format(
|
|
parsed.content_type,
|
|
parsed.content_subtype,
|
|
"+{}".format(parsed.content_suffix) if parsed.content_suffix else "",
|
|
)
|