diff --git a/litestar/handlers/http_handlers/base.py b/litestar/handlers/http_handlers/base.py index b97db1b217..b9c11461e5 100644 --- a/litestar/handlers/http_handlers/base.py +++ b/litestar/handlers/http_handlers/base.py @@ -7,6 +7,7 @@ from litestar._layers.utils import narrow_response_cookies, narrow_response_headers from litestar.connection import Request +from litestar.datastructures import CacheControlHeader, ETag, FormMultiDict from litestar.datastructures.cookie import Cookie from litestar.datastructures.response_header import ResponseHeader from litestar.enums import HttpMethod, MediaType @@ -18,7 +19,6 @@ ) from litestar.handlers.base import BaseRouteHandler from litestar.handlers.http_handlers._utils import ( - cleanup_temporary_files, create_data_handler, create_generic_asgi_response_handler, create_response_handler, @@ -65,7 +65,6 @@ from litestar.app import Litestar from litestar.background_tasks import BackgroundTask, BackgroundTasks from litestar.config.response_cache import CACHE_FOREVER - from litestar.datastructures import CacheControlHeader, ETag from litestar.dto import AbstractDTO from litestar.openapi.datastructures import ResponseSpec from litestar.openapi.spec import SecurityRequirement @@ -683,7 +682,7 @@ async def handle(self, connection: Request[Any, Any, Any]) -> None: await after_response_handler(connection) finally: if (form_data := ScopeState.from_scope(connection.scope).form) is not Empty: - await cleanup_temporary_files(form_data=cast("dict[str, Any]", form_data)) + await FormMultiDict.from_form_data(form_data).close() async def _get_response_for_request( self, diff --git a/litestar/routes/http.py b/litestar/routes/http.py index 88352f14c7..f2c8977c8e 100644 --- a/litestar/routes/http.py +++ b/litestar/routes/http.py @@ -1,13 +1,8 @@ from __future__ import annotations -from typing import Iterable -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Iterable -from msgspec.msgpack import decode as _decode_msgpack_plain - -from litestar.enums import HttpMethod, MediaType -from litestar.exceptions import ClientException, ImproperlyConfiguredException, SerializationException -from litestar.response import Response +from litestar.exceptions import ImproperlyConfiguredException from litestar.routes.base import BaseRoute from litestar.types import HTTPScope