Skip to content

Commit

Permalink
stop using #to_ary on body for Rack 2 compat and CommonLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
sorah committed Oct 17, 2022
1 parent 5f3d5e5 commit 0731e0f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/apigatewayv2_rack/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ def multivalued?

private def consume_body
case
when body.respond_to?(:to_ary)
body.to_ary.join
# FIXME: Rack::CommonLogger uses Rack::BodyProxy, which performs logging when body is closed, is not compatible with #to_ary on Rack 3 specification
# when body.respond_to?(:to_ary)
# body.to_ary.join
when body.respond_to?(:each)
buf = String.new
body.each { |chunk| buf << chunk.b }
Expand Down

0 comments on commit 0731e0f

Please sign in to comment.