Skip to content

Commit

Permalink
Removed corner case with HEAD method and Content-Length
Browse files Browse the repository at this point in the history
  • Loading branch information
nusco committed Apr 26, 2011
1 parent 7b146e2 commit 2509680
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions lib/sinatra/base.rb
Expand Up @@ -646,16 +646,7 @@ def call!(env) # :nodoc:
end
end

status, header, body = @response.finish

# On HEAD requests, if the Content-Length is "0", assume
# it was calculated erroneously for a manual HEAD response
# and remove it entirely.
if @env['REQUEST_METHOD'] == 'HEAD'
header.delete('Content-Length') if header['Content-Length'] == '0'
end

[status, header, body]
@response.finish
end

# Access settings defined with Base.set.
Expand Down

0 comments on commit 2509680

Please sign in to comment.