commit
5fcb1e1bd4
|
@ -27,7 +27,7 @@ class ResponseTest < Minitest::Test
|
|||
assert_equal 'Hello World', @response.body.join
|
||||
end
|
||||
|
||||
[204, 304].each do |status_code|
|
||||
[204, 205, 304].each do |status_code|
|
||||
it "removes the Content-Type header and body when response status is #{status_code}" do
|
||||
@response.status = status_code
|
||||
@response.body = ['Hello World']
|
||||
|
@ -35,6 +35,19 @@ class ResponseTest < Minitest::Test
|
|||
end
|
||||
end
|
||||
|
||||
[200, 201, 202, 301, 302, 400, 401, 403, 404, 500].each do |status_code|
|
||||
it "will not removes the Content-Type header and body when response status
|
||||
is #{status_code}" do
|
||||
@response.status = status_code
|
||||
@response.body = ['Hello World']
|
||||
assert_equal [
|
||||
status_code,
|
||||
{ 'Content-Type' => 'text/html', 'Content-Length' => '11' },
|
||||
['Hello World']
|
||||
], @response.finish
|
||||
end
|
||||
end
|
||||
|
||||
it 'Calculates the Content-Length using the bytesize of the body' do
|
||||
@response.body = ['Hello', 'World!', '✈']
|
||||
_, headers, body = @response.finish
|
||||
|
|
Loading…
Reference in New Issue