Class: Cannon::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/cannon/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_server, app) ⇒ Request

Returns a new instance of Request.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cannon/request.rb', line 8

def initialize(http_server, app)
  self.protocol = http_server.instance_variable_get('@http_protocol')
  self.method = http_server.instance_variable_get('@http_request_method')
  self.http_cookie = http_server.instance_variable_get('@http_cookie')
  self.content_type = http_server.instance_variable_get('@http_content_type')
  self.path = http_server.instance_variable_get('@http_path_info')
  self.uri = http_server.instance_variable_get('@http_request_uri')
  self.query_string = http_server.instance_variable_get('@http_query_string')
  self.post_content = http_server.instance_variable_get('@http_post_content')
  self.headers = http_server.instance_variable_get('@http_headers')
  self.start_time = Time.now
end

Instance Attribute Details

#content_typeObject

Returns the value of attribute content_type.



5
6
7
# File 'lib/cannon/request.rb', line 5

def content_type
  @content_type
end

#headersObject

Returns the value of attribute headers.



5
6
7
# File 'lib/cannon/request.rb', line 5

def headers
  @headers
end

Returns the value of attribute http_cookie.



5
6
7
# File 'lib/cannon/request.rb', line 5

def http_cookie
  @http_cookie
end

#methodObject

Returns the value of attribute method.



5
6
7
# File 'lib/cannon/request.rb', line 5

def method
  @method
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/cannon/request.rb', line 5

def path
  @path
end

#post_contentObject

Returns the value of attribute post_content.



5
6
7
# File 'lib/cannon/request.rb', line 5

def post_content
  @post_content
end

#protocolObject

Returns the value of attribute protocol.



5
6
7
# File 'lib/cannon/request.rb', line 5

def protocol
  @protocol
end

#query_stringObject

Returns the value of attribute query_string.



5
6
7
# File 'lib/cannon/request.rb', line 5

def query_string
  @query_string
end

#start_timeObject

Returns the value of attribute start_time.



5
6
7
# File 'lib/cannon/request.rb', line 5

def start_time
  @start_time
end

#uriObject

Returns the value of attribute uri.



5
6
7
# File 'lib/cannon/request.rb', line 5

def uri
  @uri
end

Instance Method Details

#paramsObject



21
22
23
# File 'lib/cannon/request.rb', line 21

def params
  @params ||= parse_params
end