lib/roda/response.rb in roda-3.59.0 vs lib/roda/response.rb in roda-3.60.0
- old
+ new
@@ -40,20 +40,18 @@
# The status code to use for the response. If none is given, will use 200
# code for non-empty responses and a 404 code for empty responses.
attr_accessor :status
- # :nocov:
if defined?(Rack::Headers) && Rack::Headers.is_a?(Class)
# Set the default headers when creating a response.
def initialize
@headers = Rack::Headers.new
@body = []
@length = 0
end
else
- # :nocov:
# Set the default headers when creating a response.
def initialize
@headers = {}
@body = []
@length = 0
@@ -171,18 +169,16 @@
nil
end
private
- # :nocov:
if Rack.release < '2.0.2'
# Don't use a content length for empty 205 responses on
# rack 1, as it violates Rack::Lint in that version.
def empty_205_headers(headers)
headers.delete("Content-Type")
headers.delete("Content-Length")
end
- # :nocov:
else
# Set the content length for empty 205 responses to 0
def empty_205_headers(headers)
headers.delete("Content-Type")
headers["Content-Length"] = '0'