-
Notifications
You must be signed in to change notification settings - Fork 87
Conversation
Encapsulate request bodies in their own object. This allows easy conversion to a string in cases where streaming isn't desired, or streaming as an IO-alike through #read and #readpartial This is a breaking change from the previous API. People who were using request.body will now need to use request.body.to_s. The previous callback-based API for reading the body is completely removed.
end | ||
|
||
# Eagerly consume the entire body as a string | ||
def to_s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ponder whether this might be better called string
as in StringIO
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps. That said I'm trying to allow this body to passed directly through in e.g. Webmachine, and they probably want a #to_s
style API. Still waiting to hear back from @seancribbs on that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either could be solved with an alias.
This looks good to me - getting rid of that callback for the body block is nice, that code felt kind of ugly. |
There's a bug somewhere in this code. I'm getting Will continue investigating... and hopefully capture this case in a test |
Encapsulate request bodies in their own object. This allows easy conversion to a
string in cases where streaming isn't desired, or streaming as an IO-alike
through #read and #readpartial
This is a breaking change from the previous API. People who were using
request.body will now need to use request.body.to_s. The previous callback-based
API for reading the body is completely removed.
/cc @adstage-david @raggi @halorgium