Class: Async::HTTP::Protocol::HTTP2::Response

Inherits:
Response show all
Defined in:
lib/async/http/protocol/http2.rb

Instance Attribute Summary

Attributes inherited from Response

#protocol

Attributes inherited from Response

#body, #headers, #reason, #status, #version

Instance Method Summary collapse

Methods inherited from Response

#hijack?, #peer, #remote_address, #remote_address=

Methods inherited from Response

[], #bad_request?, #continue?, #failure?, for_exception, #partial?, #preserve_method?, #redirection?, #server_failure?, #success?, #to_s

Methods included from Body::Reader

#close, #each, #finish, #read, #stop

Constructor Details

#initialize(protocol, stream) ⇒ Response

Returns a new instance of Response.



245
246
247
248
249
250
# File 'lib/async/http/protocol/http2.rb', line 245

def initialize(protocol, stream)
	super(self.version, nil, nil, Headers.new, Body::Writable.new)
	
	@protocol = protocol
	@stream = stream
end

Instance Method Details

#assign_headers(headers) ⇒ Object



252
253
254
255
256
257
258
259
260
261
262
# File 'lib/async/http/protocol/http2.rb', line 252

def assign_headers(headers)
	headers.each do |key, value|
		if key == STATUS
			@status = value.to_i
		elsif key == REASON
			@reason = value
		else
			@headers[key] = value
		end
	end
end