Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Body argument is deprecated for http web exceptions #82

Open
alvassin opened this issue Feb 23, 2020 · 0 comments
Open

Body argument is deprecated for http web exceptions #82

alvassin opened this issue Feb 23, 2020 · 0 comments

Comments

@alvassin
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant