aiohttp-apispec
aiohttp-apispec copied to clipboard
Body argument is deprecated for http web exceptions
In example for custom validation errors handling you raise HTTPException with body argument:
def my_error_handler(
error: ValidationError,
req: web.Request,
schema: Schema,
error_status_code: Optional[int] = None,
error_headers: Optional[Mapping[str, str]] = None,
) -> NoReturn:
raise web.HTTPBadRequest(
body=json.dumps(error.messages),
headers=error_headers,
content_type="application/json",
)
I see many DeprecationWarning: body argument is deprecated for http web exceptions warnings.
According to this issue it was deprecated in aiohttp in 2018.