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

Disable body parameter in HTTPException constructor #3385

Closed
asvetlov opened this issue Nov 8, 2018 · 5 comments · Fixed by #3420
Closed

Disable body parameter in HTTPException constructor #3385

asvetlov opened this issue Nov 8, 2018 · 5 comments · Fixed by #3420

Comments

@asvetlov
Copy link
Member

asvetlov commented Nov 8, 2018

Now the exception can be created with either body or text.
It over complicates things in a light of removing inheritance from web.Response.

Let's deprecate body before changing the inheritance hierarchy.

@aio-libs-bot aio-libs-bot added the good first issue Good for newcomers label Nov 8, 2018
@aio-libs-bot
Copy link

GitMate.io thinks possibly related issues are #593 (Add charset parameter to web.Response constructor), #1992 ([enhancement] Add ability to disable automatic decompression of body), #193 (Should aiohttp.web.Response accept body as positional parameter?), #2067 (Disable Cookie Handling), and #2262 (Disable DNS cache).

@eirnym
Copy link

eirnym commented May 11, 2019

Does it mean, that I can't send back a binary here? I have a requirement to communicate using binary protocol and this change is breaking my ability to use exceptions

@kxepal
Copy link
Member

kxepal commented May 11, 2019

Why do you need to use exceptions for such communication?

@eirnym
Copy link

eirnym commented May 11, 2019

I don't need to check very-special-values when return from the function and able to throw an HTTP error.
Such exceptions in aiohttp and other frameworks (including other languages) are used interchangeable with Response objects to indicate an HTTP error in more clear way than using plain Response object. aiohttp is not an exception to this.

I agree, that not every http response require/accept a body at all.

@eirnym
Copy link

eirnym commented May 11, 2019

In my case I want to provide client with some additional contextual information where the error occurred.

@lock lock bot added the outdated label May 20, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants