-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
error reading body_io of a zero length http client response #8461
Comments
This should probably raise a better error but I think this was how the API was designed. |
Response#body is the empty string in this case. Not sure why body_io wouldn't similarly be functional but empty... ? :) |
I think the issue is valid. The culprits are these lines: Lines 41 to 44 in 440cd67
The response from bing.com contains Maybe it's an optimization we thought would make sense, but it doesn't. |
What about the case An alternative solution to #8503 could be do change |
Yes, an empty IO might be good. Maybe just using I don't think creating |
Yeah, I wasn't suggesting a new type, just an
Probably not, but it's a cheap optimization, easy to implement. And nonetheless, it saves two heap allocations (or maybe just one, we could return an empty |
Let's do that. I'll update my PR later. |
Actually, if someone wants to tackle this, please go ahead. I think my PR is fine. If you get a response in the non-block form then |
Maybe this is simply caused by a flaw in the API. When simply accessing a property is expected to raise when the API is used in a valid manner, it sounds some alarm bells. Is this really the correct way we want our API to work? An alternative solution would be to remove It's also used in |
@straight-shoota Yes, proxying is a use case that should be supported. I don't think having to carry the IO separate from the response seems a bit more troublesome than the current approach. |
Here's the example:
would have expected the empty IO or something, so that the examples would still work?
The text was updated successfully, but these errors were encountered: