Skip to content

Commit e662408

Browse files
committed
Don't add content-length header.
1 parent 35b7310 commit e662408

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/rack/test.rb

-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ def process_request(uri, env)
363363
close_body(body)
364364
cookie_jar.merge(last_response.headers['set-cookie'], uri)
365365
@after_request.each(&:call)
366-
@last_response.finish
367366

368367
yield @last_response if block_given?
369368

spec/fixtures/fake_app.rb

-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ module Test
66
class FakeApp
77
def call(env)
88
_, h, b = res = handle(env)
9-
length = 0
10-
b.each{|s| length += s.bytesize}
11-
h['content-length'] = length.to_s
129
h['content-type'] = 'text/html;charset=utf-8'
1310
res
1411
end

spec/rack/test_spec.rb

+5
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,11 @@ def closed?
503503
last_response['content-type'].must_equal 'text/html;charset=utf-8'
504504
end
505505

506+
it 'should not add a content-length header' do
507+
request '/'
508+
last_response['content-length'].must_be_nil
509+
end
510+
506511
it 'raises an error if no requests have been issued' do
507512
proc do
508513
last_response

0 commit comments

Comments
 (0)