mirror of https://github.com/tiangolo/fastapi.git
⬆ Upgrade Starlette from 0.19.0 to 0.19.1 (#4819)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
parent
0696454445
commit
f396912043
|
|
@ -1,5 +1,16 @@
|
|||
from enum import Enum
|
||||
from typing import Any, Callable, Coroutine, Dict, List, Optional, Sequence, Type, Union
|
||||
from typing import (
|
||||
Any,
|
||||
Awaitable,
|
||||
Callable,
|
||||
Coroutine,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Sequence,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
from fastapi import routing
|
||||
from fastapi.datastructures import Default, DefaultPlaceholder
|
||||
|
|
@ -121,11 +132,8 @@ class FastAPI(Starlette):
|
|||
generate_unique_id_function=generate_unique_id_function,
|
||||
)
|
||||
self.exception_handlers: Dict[
|
||||
Union[int, Type[Exception]],
|
||||
Callable[[Request, Any], Coroutine[Any, Any, Response]],
|
||||
] = (
|
||||
{} if exception_handlers is None else dict(exception_handlers)
|
||||
)
|
||||
Any, Callable[[Request, Any], Union[Response, Awaitable[Response]]]
|
||||
] = ({} if exception_handlers is None else dict(exception_handlers))
|
||||
self.exception_handlers.setdefault(HTTPException, http_exception_handler)
|
||||
self.exception_handlers.setdefault(
|
||||
RequestValidationError, request_validation_exception_handler
|
||||
|
|
|
|||
|
|
@ -12,9 +12,7 @@ class HTTPException(StarletteHTTPException):
|
|||
detail: Any = None,
|
||||
headers: Optional[Dict[str, Any]] = None,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
status_code=status_code, detail=detail, headers=headers # type: ignore
|
||||
)
|
||||
super().__init__(status_code=status_code, detail=detail, headers=headers)
|
||||
|
||||
|
||||
RequestErrorModel: Type[BaseModel] = create_model("Request")
|
||||
|
|
|
|||
|
|
@ -478,11 +478,11 @@ class APIRouter(routing.Router):
|
|||
),
|
||||
) -> None:
|
||||
super().__init__(
|
||||
routes=routes, # type: ignore # in Starlette
|
||||
routes=routes,
|
||||
redirect_slashes=redirect_slashes,
|
||||
default=default, # type: ignore # in Starlette
|
||||
on_startup=on_startup, # type: ignore # in Starlette
|
||||
on_shutdown=on_shutdown, # type: ignore # in Starlette
|
||||
default=default,
|
||||
on_startup=on_startup,
|
||||
on_shutdown=on_shutdown,
|
||||
)
|
||||
if prefix:
|
||||
assert prefix.startswith("/"), "A path prefix must start with '/'"
|
||||
|
|
@ -757,7 +757,7 @@ class APIRouter(routing.Router):
|
|||
generate_unique_id_function=current_generate_unique_id,
|
||||
)
|
||||
elif isinstance(route, routing.Route):
|
||||
methods = list(route.methods or []) # type: ignore # in Starlette
|
||||
methods = list(route.methods or [])
|
||||
self.add_route(
|
||||
prefix + route.path,
|
||||
route.endpoint,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ classifiers = [
|
|||
"Topic :: Internet :: WWW/HTTP",
|
||||
]
|
||||
requires = [
|
||||
"starlette==0.19.0",
|
||||
"starlette==0.19.1",
|
||||
"pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
|
||||
]
|
||||
description-file = "README.md"
|
||||
|
|
|
|||
Loading…
Reference in New Issue