diff --git a/fastapi/middleware/csrf.py b/fastapi/middleware/csrf.py index b9aefbdd0a..a1729de6f1 100644 --- a/fastapi/middleware/csrf.py +++ b/fastapi/middleware/csrf.py @@ -2,7 +2,8 @@ import functools import http.cookies import secrets from re import Pattern -from typing import Dict, List, Optional, Set, Any +from typing import Any, Dict, List, Optional, Set + from itsdangerous import BadSignature from itsdangerous.url_safe import URLSafeSerializer from starlette.datastructures import URL, MutableHeaders @@ -152,8 +153,9 @@ class CSRFMiddleware: ) def _receive_with_body(self, receive, body) -> dict: - async def inner() -> dict : + async def inner() -> dict: return {"type": "http.request", "body": body, "more_body": False} + return inner @@ -169,4 +171,5 @@ def csrf_token_processor(csrf_cookie_name: str, csrf_header_name: str): "csrf_input": csrf_input, "csrf_header": csrf_header, } - return processor \ No newline at end of file + + return processor