Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #603 from raggi/rack-1.4

Update Sinatra::Response#finish for Rack 1.5
  • Loading branch information...
commit 3d0cef2ea7248d98bc50359ac0c1ef0978dfe042 2 parents 08373e8 + aea6649
@rkh rkh authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/sinatra/base.rb
View
4 lib/sinatra/base.rb
@@ -76,7 +76,7 @@ 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
@@ -84,7 +84,7 @@ def finish
# 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
Please sign in to comment.
Something went wrong with that request. Please try again.