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")
"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"
"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',
]
@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}")
@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)