lib/rack/mock.rb in rack-0.9.1 vs lib/rack/mock.rb in rack-1.0.0
- old
+ new
@@ -95,10 +95,12 @@
env["rack.input"] = StringIO.new(opts[:input])
else
env["rack.input"] = opts[:input]
end
+ env["CONTENT_LENGTH"] ||= env["rack.input"].length.to_s
+
opts.each { |field, value|
env[field] = value if String === field
}
env
@@ -114,12 +116,10 @@
@status = status.to_i
@original_headers = headers
@headers = Rack::Utils::HeaderHash.new
headers.each { |field, values|
- values.each { |value|
- @headers[field] = value
- }
+ @headers[field] = values
@headers[field] = "" if values.empty?
}
@body = ""
body.each { |part| @body << part }