Remove status code 205 from drop body responses

This commit is contained in:
Shota Iguchi 2018-02-22 01:02:05 +09:00
parent 299961ddd7
commit 28a8f4cdef
3 changed files with 3 additions and 3 deletions

View File

@ -132,7 +132,7 @@ module Sinatra
# http://rubydoc.info/github/rack/rack/master/Rack/Response
# http://rubydoc.info/github/rack/rack/master/Rack/Response/Helpers
class Response < Rack::Response
DROP_BODY_RESPONSES = [204, 205, 304]
DROP_BODY_RESPONSES = [204, 304]
def initialize(*)
super
headers['Content-Type'] ||= 'text/html'

View File

@ -8,7 +8,7 @@ class HelpersTest < Minitest::Test
end
def status_app(code, &block)
code += 2 if [204, 205, 304].include? code
code += 2 if [204, 304].include? code
block ||= proc { }
mock_app do
get('/') do

View File

@ -27,7 +27,7 @@ class ResponseTest < Minitest::Test
assert_equal 'Hello World', @response.body.join
end
[204, 205, 304].each do |status_code|
[204, 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']