File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 11import pytest
2- from litestar import Litestar
3- from litestar .exceptions import HTTPException
2+ from litestar import Litestar , post
43from starlette .status import HTTP_413_REQUEST_ENTITY_TOO_LARGE
54from litestar .testing import create_test_client
65
7- # Define a proper handler at module level
6+ @ post ( "/upload" )
87async def upload_handler (data ):
98 return {"success" : True }
109
1110@pytest .mark .anyio
1211async def test_oversized_file_returns_413 ():
1312 app = Litestar (
1413 route_handlers = [upload_handler ],
15- multipart_form_part_limit = 10 , # Small limit to trigger the error
14+ multipart_form_part_limit = 10 , # small limit to trigger the error
1615 )
1716
1817 async with create_test_client (app ) as client :
19- response = await client .post ("/upload" , data = {"file" : "x" * 100 }) # Example oversized data
18+ response = await client .post ("/upload" , data = {"file" : "x" * 100 })
2019 assert response .status_code == HTTP_413_REQUEST_ENTITY_TOO_LARGE
You can’t perform that action at this time.
0 commit comments