app.middleware
Description
WSGI middleware for validating requests content type.
Classes
|
WSGI middleware for checking if the request has a valid content type. |
- class app.middleware.Middleware(app: flask.app.Flask)
WSGI middleware for checking if the request has a valid content type.
- static parse_content_type(content_type: str) str
Parser a request Content-Type.
- Parameters
content_type (str) – Request Content Type.
- Returns
Parsed request Content Type.
- Return type
str
References
RFC 1341 - MIME (Multipurpose Internet Mail Extensions): https://tools.ietf.org/html/rfc1341
Examples
>>> from app.middleware import Middleware as m >>> m.parse_content_type('multipart/form-data; boundary=something') multipart/form-data >>> m.parse_content_type('text/html; charset=utf-8') text/html