Class: Noder::HTTP::Request

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Request

Returns a new instance of Request.



7
8
9
10
11
12
13
14
# File 'lib/noder/http/request.rb', line 7

def initialize(env)
  @env = env
  @query = HTTP::Utils.parse(env[:query_string])
  @params = @query
  if env[:post_content] && env[:post_content] != ''
    @params.merge!(HTTP::Utils.parse(env[:post_content]))
  end
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



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

def env
  @env
end

#paramsObject

Returns the value of attribute params.



4
5
6
# File 'lib/noder/http/request.rb', line 4

def params
  @params
end

Instance Method Details

#content_typeObject



28
29
30
# File 'lib/noder/http/request.rb', line 28

def content_type
  env[:content_type]
end


24
25
26
# File 'lib/noder/http/request.rb', line 24

def cookie
  env[:cookie]
end

#headersObject



16
17
18
# File 'lib/noder/http/request.rb', line 16

def headers
  @headers ||= HTTP::Utils.parse_headers(env[:headers])
end

#ipObject



48
49
50
# File 'lib/noder/http/request.rb', line 48

def ip
  env[:ip]
end

#post_contentObject



40
41
42
# File 'lib/noder/http/request.rb', line 40

def post_content
  env[:post_content]
end

#protocolObject



44
45
46
# File 'lib/noder/http/request.rb', line 44

def protocol
  env[:protocol]
end

#query_stringObject



36
37
38
# File 'lib/noder/http/request.rb', line 36

def query_string
  env[:query_string]
end

#request_methodObject



20
21
22
# File 'lib/noder/http/request.rb', line 20

def request_method
  env[:request_method]
end

#request_uriObject



32
33
34
# File 'lib/noder/http/request.rb', line 32

def request_uri
  env[:request_uri]
end