mewgenics_heredity/mewgenics_heredity/middlewares/UrlEncodedMiddleware.py
2026-02-24 22:14:36 +01:00

24 lines
665 B
Python

from litestar.types import Scope, Receive, Send, ASGIApp
from litestar.middleware import ASGIMiddleware
from litestar.enums import ScopeType
from litestar.datastructures import Headers
from pprint import pprint
class UrlEncodedMiddleware(ASGIMiddleware):
scopes = (ScopeType.HTTP,)
async def handle(
self,
scope: Scope,
receive: Receive,
send: Send,
next_app: ASGIApp
) -> None:
headers = Headers.from_scope(scope)
if scope['method'] in ['POST', 'PUT', 'PATCH'] and headers['Content-Type'] == 'application/x-www-form-urlencoded':
pass
await next_app(scope, receive, send)