lib/protocol/http/response.rb in protocol-http-0.17.0 vs lib/protocol/http/response.rb in protocol-http-0.18.0
- old
+ new
@@ -26,11 +26,11 @@
module Protocol
module HTTP
class Response
prepend Body::Reader
- def initialize(version = nil, status = 200, headers = [], body = nil, protocol = nil)
+ def initialize(version = nil, status = 200, headers = Headers.new, body = nil, protocol = nil)
@version = version
@status = status
@headers = headers
@body = body
@protocol = protocol
@@ -40,16 +40,10 @@
attr_accessor :status
attr_accessor :headers
attr_accessor :body
attr_accessor :protocol
- def trailers
- if @headers.respond_to?(:trailers)
- @headers.trailers
- end
- end
-
def hijack?
false
end
def continue?
@@ -86,10 +80,10 @@
def server_failure?
@status == 500
end
- def self.[](status, headers = [], body = nil, protocol = nil)
+ def self.[](status, headers = nil, body = nil, protocol = nil)
body = Body::Buffered.wrap(body)
headers = ::Protocol::HTTP::Headers[headers]
self.new(nil, status, headers, body, protocol)
end