Skip to content
Browse files

Update Sinatra::Response#finish for Rack 1.5

  • Loading branch information...
1 parent 08373e8 commit aea66494275bd3fbfd124715c9f3541b86404fe7 @raggi committed Jan 4, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/sinatra/base.rb
View
4 lib/sinatra/base.rb
@@ -76,15 +76,15 @@ def finish
if status.to_i / 100 == 1
headers.delete "Content-Length"
headers.delete "Content-Type"
- elsif Array === body and not [204, 304].include?(status.to_i)
+ elsif Array === body and not [204, 205, 304].include?(status.to_i)
# if some other code has already set Content-Length, don't muck with it
# currently, this would be the static file-handler
headers["Content-Length"] ||= body.inject(0) { |l, p| l + Rack::Utils.bytesize(p) }.to_s
end
# Rack::Response#finish sometimes returns self as response body. We don't want that.
status, headers, result = super
- result = body if result == self
+ result = body if result == self || Rack::BodyProxy === result
[status, headers, result]
end
end

0 comments on commit aea6649

Please sign in to comment.
Something went wrong with that request. Please try again.