Skip to content

Commit

Permalink
⬆ Upgrade Starlette from 0.18.0 to 0.19.0 (#4488)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
  • Loading branch information
Kludex and tiangolo committed May 9, 2022
1 parent 9090c77 commit 86fa3cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions fastapi/exceptions.py
Expand Up @@ -12,8 +12,9 @@ def __init__(
detail: Any = None,
headers: Optional[Dict[str, Any]] = None,
) -> None:
super().__init__(status_code=status_code, detail=detail)
self.headers = headers
super().__init__(
status_code=status_code, detail=detail, headers=headers # type: ignore
)


RequestErrorModel: Type[BaseModel] = create_model("Request")
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Expand Up @@ -35,7 +35,7 @@ classifiers = [
"Topic :: Internet :: WWW/HTTP",
]
requires = [
"starlette ==0.18.0",
"starlette==0.19.0",
"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"
Expand Down Expand Up @@ -140,6 +140,7 @@ filterwarnings = [
"error",
# TODO: needed by asyncio in Python 3.9.7 https://bugs.python.org/issue45097, try to remove on 3.9.8
'ignore:The loop argument is deprecated since Python 3\.8, and scheduled for removal in Python 3\.10:DeprecationWarning:asyncio',
'ignore:starlette.middleware.wsgi is deprecated and will be removed in a future release\..*:DeprecationWarning:starlette',
# TODO: remove after dropping support for Python 3.6
'ignore:Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.:UserWarning:jose',
]
6 changes: 3 additions & 3 deletions tests/test_extra_routes.py
Expand Up @@ -32,12 +32,12 @@ def delete_item(item_id: str, item: Item):

@app.head("/items/{item_id}")
def head_item(item_id: str):
return JSONResponse(headers={"x-fastapi-item-id": item_id})
return JSONResponse(None, headers={"x-fastapi-item-id": item_id})


@app.options("/items/{item_id}")
def options_item(item_id: str):
return JSONResponse(headers={"x-fastapi-item-id": item_id})
return JSONResponse(None, headers={"x-fastapi-item-id": item_id})


@app.patch("/items/{item_id}")
Expand All @@ -47,7 +47,7 @@ def patch_item(item_id: str, item: Item):

@app.trace("/items/{item_id}")
def trace_item(item_id: str):
return JSONResponse(media_type="message/http")
return JSONResponse(None, media_type="message/http")


client = TestClient(app)
Expand Down

0 comments on commit 86fa3cb

Please sign in to comment.