Improve error message when body size of a request is unknown#560
Improve error message when body size of a request is unknown#560savonarola wants to merge 1 commit intohttprb:masterfrom savonarola:master
Conversation
|
IMO this details should not be in exception details. It belongs to documentation/wiki. |
|
@httprb/core WDYT? |
|
I think for bodies that do not support |
👍The user should still be able to specify On a related note, I also think that for IO-like objects we don't need to require Line 21 in 6240672 |
|
@janko I agree. |
|
Hello! Just wanted to clarify, is this issue still worth being opened? As far as I can see, it was automatically closed because of the main branch rename. |
|
I think so.
…On Tue, 14 Sep 2021, 13:14 Ilya Averyanov, ***@***.***> wrote:
Hello!
Just wanted to clarify, is this issue still worth being opened? As far as
I can see, it was automatically closed because of the main branch rename.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#560 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAXEPRELL23SGYVVK5KRP3UB4U75ANCNFSM4IKKVJPQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Suggest setting `Content-Length` header manually in case we can't guess body size. See-Also: #560
|
Reopened as #689 |
Suggest setting `Content-Length` header manually in case we can't guess body size. See-Also: #560 Co-Authored-By: @savonarola <ilya.averyanov@gmail.com>
|
Yep, sorry, pardon my dust |
Suggest setting `Content-Length` header manually in case we can't guess body size. See-Also: #560 Co-Authored-By: @savonarola <ilya.averyanov@gmail.com>
Hello!
Recently I tried to send an Enumerable object as a body for a request:
This is a valid body according to the code: https://github.com/httprb/http/blob/master/lib/http/request/body.rb#L76
But the request failed with the exception
cannot determine size of body: ...Indeed, although
Enumerableis a valid option for body, there is no corresponding case in#sizefunction: https://github.com/httprb/http/blob/master/lib/http/request/body.rb#L17It seemed a bit vague for me and took some time to figure out that in this case one should set
Content-Lengthheader explicitly so thatBody#sizeis not called: https://github.com/httprb/http/blob/master/lib/http/request/writer.rb#L50It seemed for me that it would be useful to have some hint on it in the error message.