Class: Async::HTTP::Protocol::HTTP2::Request

Inherits:
Request
  • Object
show all
Defined in:
lib/async/http/protocol/http2.rb

Instance Attribute Summary collapse

Attributes inherited from Request

#authority, #body, #headers, #method, #path, #version

Instance Method Summary collapse

Methods inherited from Request

[], #connect?, #head?, #idempotent?, #to_s

Methods included from Body::Buffered::Reader

#finish, #read

Constructor Details

#initialize(stream) ⇒ Request

Returns a new instance of Request.



126
127
128
129
130
# File 'lib/async/http/protocol/http2.rb', line 126

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

Instance Attribute Details

#streamObject (readonly)

Returns the value of attribute stream.



132
133
134
# File 'lib/async/http/protocol/http2.rb', line 132

def stream
  @stream
end

Instance Method Details

#assign_headers(headers) ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/async/http/protocol/http2.rb', line 134

def assign_headers(headers)
	headers.each do |key, value|
		if key == METHOD
			raise BadRequest, "Request method already specified" if @method
			
			@method = value
		elsif key == PATH
			raise BadRequest, "Request path already specified" if @path
			
			@path = value
		elsif key == AUTHORITY
			raise BadRequest, "Request authority already specified" if @authority
			
			@authority = value
		else
			@headers[key] = value
		end
	end
end

#hijack?Boolean

Returns:

  • (Boolean)


154
155
156
# File 'lib/async/http/protocol/http2.rb', line 154

def hijack?
	false
end