Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't add content-length header. #347

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/rack/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ def process_request(uri, env)
close_body(body)
cookie_jar.merge(last_response.headers['set-cookie'], uri)
@after_request.each(&:call)
@last_response.finish

yield @last_response if block_given?

Expand Down
3 changes: 0 additions & 3 deletions spec/fixtures/fake_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ module Test
class FakeApp
def call(env)
_, h, b = res = handle(env)
length = 0
b.each{|s| length += s.bytesize}
h['content-length'] = length.to_s
h['content-type'] = 'text/html;charset=utf-8'
res
end
Expand Down
5 changes: 5 additions & 0 deletions spec/rack/test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,11 @@ def closed?
last_response['content-type'].must_equal 'text/html;charset=utf-8'
end

it 'should not add a content-length header' do
request '/'
last_response['content-length'].must_be_nil
end

it 'raises an error if no requests have been issued' do
proc do
last_response
Expand Down
Loading