Closed adstage-david closed 9 years ago
Might be slightly messy way to do it, but maybe .to_s.empty?
can be the .empty?
contents?
It depends on where #empty?
occurs in the request lifecycle. It would be bad if it triggered an eager early read of a large request body
@tarcieri, would it be cool to begin reading the input stream asynchronously after the first read, and respond false
for #empty?
once one read succeeds?
Seems a bit extreme to defer reading just for #empty?
but I think it would have benefits outside that.
@digitalextremist that should be possible
Released in 0.6.0.pre1
Just upgraded to Webmachine 1.2.1+Reel 0.4.0 and found that request.body was now returning Reel RequestBody objects no matter what. This breaks the way
request.has_body?
works in webmachine, since RequestBody doesn't respond to#empty?
:https://github.com/seancribbs/webmachine-ruby/blob/master/lib/webmachine/request.rb#L39
Easy enough to work around in my code, but maybe a function should be added so that
#has_body?
can return the right value in webmachine?