Skip to content

Commit 7563579

Browse files
⬆️ Upgrade Starlette supported version range to >=0.40.0,<0.49.0 (#14077)
Co-authored-by: svlandeg <svlandeg@github.com>
1 parent 938dd04 commit 7563579

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

docs_src/handling_errors/tutorial005.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from fastapi import FastAPI, Request, status
1+
from fastapi import FastAPI, Request
22
from fastapi.encoders import jsonable_encoder
33
from fastapi.exceptions import RequestValidationError
44
from fastapi.responses import JSONResponse
@@ -10,7 +10,7 @@
1010
@app.exception_handler(RequestValidationError)
1111
async def validation_exception_handler(request: Request, exc: RequestValidationError):
1212
return JSONResponse(
13-
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
13+
status_code=422,
1414
content=jsonable_encoder({"detail": exc.errors(), "body": exc.body}),
1515
)
1616

fastapi/exception_handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from starlette.exceptions import HTTPException
66
from starlette.requests import Request
77
from starlette.responses import JSONResponse, Response
8-
from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY, WS_1008_POLICY_VIOLATION
8+
from starlette.status import WS_1008_POLICY_VIOLATION
99

1010

1111
async def http_exception_handler(request: Request, exc: HTTPException) -> Response:
@@ -21,7 +21,7 @@ async def request_validation_exception_handler(
2121
request: Request, exc: RequestValidationError
2222
) -> JSONResponse:
2323
return JSONResponse(
24-
status_code=HTTP_422_UNPROCESSABLE_ENTITY,
24+
status_code=422,
2525
content={"detail": jsonable_encoder(exc.errors())},
2626
)
2727

fastapi/openapi/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from pydantic import BaseModel
3636
from starlette.responses import JSONResponse
3737
from starlette.routing import BaseRoute
38-
from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY
3938
from typing_extensions import Literal
4039

4140
validation_error_definition = {
@@ -416,7 +415,7 @@ def get_openapi_path(
416415
)
417416
deep_dict_update(openapi_response, process_response)
418417
openapi_response["description"] = description
419-
http422 = str(HTTP_422_UNPROCESSABLE_ENTITY)
418+
http422 = "422"
420419
all_route_params = get_flat_params(route.dependant)
421420
if (all_route_params or route.body_field) and not any(
422421
status in operation["responses"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ classifiers = [
4343
"Topic :: Internet :: WWW/HTTP",
4444
]
4545
dependencies = [
46-
"starlette>=0.40.0,<0.48.0",
46+
"starlette>=0.40.0,<0.49.0",
4747
"pydantic>=1.7.4,!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0",
4848
"typing-extensions>=4.8.0",
4949
]

tests/test_enforce_once_required_parameter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_schema():
102102

103103
def test_get_invalid():
104104
response = client.get("/foo")
105-
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
105+
assert response.status_code == 422
106106

107107

108108
def test_get_valid():

0 commit comments

Comments
 (0)