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

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

Instance Attribute Summary collapse

Attributes inherited from Request

#protocol

Attributes inherited from Request

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

Instance Method Summary collapse

Methods inherited from Request

#peer, #remote_address, #remote_address=

Methods inherited from Request

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

Methods included from Body::Reader

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

Constructor Details

#initialize(protocol, stream) ⇒ Request

Returns a new instance of Request.



128
129
130
131
132
133
# File 'lib/async/http/protocol/http2.rb', line 128

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

Instance Attribute Details

#streamObject (readonly)

Returns the value of attribute stream.



139
140
141
# File 'lib/async/http/protocol/http2.rb', line 139

def stream
  @stream
end

Instance Method Details

#assign_headers(headers) ⇒ Object



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/async/http/protocol/http2.rb', line 141

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)


135
136
137
# File 'lib/async/http/protocol/http2.rb', line 135

def hijack?
  false
end