]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
⬆ Upgrade Starlette from 0.18.0 to 0.19.0 (#4488)
authorMarcelo Trylesinski <marcelotryle@gmail.com>
Mon, 9 May 2022 18:06:42 +0000 (20:06 +0200)
committerGitHub <noreply@github.com>
Mon, 9 May 2022 18:06:42 +0000 (13:06 -0500)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
fastapi/exceptions.py
pyproject.toml
tests/test_extra_routes.py

index f4a837bb4e2bf4621d3e8cfcd855c84f15aaae2b..fcb7187488f02680e128b9a0c778ee9d66316a73 100644 (file)
@@ -12,8 +12,9 @@ class HTTPException(StarletteHTTPException):
         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")
index 1a26107406e70ab74b590211463c71c41f5eefe7..fc803f8fc5da79030ea489f4fde33e6dd68cfae7 100644 (file)
@@ -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"
@@ -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',
 ]
index 8f95b7bc99638a444b93ab2bbf982efa7d363b2c..491ba61c68040ad3b37eb9baa35a550747326630 100644 (file)
@@ -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}")
@@ -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)