mirror of
https://github.com/correl/tornado-openapi3.git
synced 2024-11-23 19:19:55 +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 "",
|
|
)
|