Class: Noder::HTTP::Request
- Inherits:
-
Object
- Object
- Noder::HTTP::Request
- Defined in:
- lib/noder/http/request.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #content_type ⇒ Object
- #cookie ⇒ Object
- #headers ⇒ Object
-
#initialize(env) ⇒ Request
constructor
A new instance of Request.
- #ip ⇒ Object
- #post_content ⇒ Object
- #protocol ⇒ Object
- #query_string ⇒ Object
- #request_method ⇒ Object
- #request_uri ⇒ Object
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
#env ⇒ Object (readonly)
Returns the value of attribute env.
5 6 7 |
# File 'lib/noder/http/request.rb', line 5 def env @env end |
#params ⇒ Object
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_type ⇒ Object
28 29 30 |
# File 'lib/noder/http/request.rb', line 28 def content_type env[:content_type] end |
#cookie ⇒ Object
24 25 26 |
# File 'lib/noder/http/request.rb', line 24 def env[:cookie] end |
#headers ⇒ Object
16 17 18 |
# File 'lib/noder/http/request.rb', line 16 def headers @headers ||= HTTP::Utils.parse_headers(env[:headers]) end |
#ip ⇒ Object
48 49 50 |
# File 'lib/noder/http/request.rb', line 48 def ip env[:ip] end |
#post_content ⇒ Object
40 41 42 |
# File 'lib/noder/http/request.rb', line 40 def post_content env[:post_content] end |
#protocol ⇒ Object
44 45 46 |
# File 'lib/noder/http/request.rb', line 44 def protocol env[:protocol] end |
#query_string ⇒ Object
36 37 38 |
# File 'lib/noder/http/request.rb', line 36 def query_string env[:query_string] end |
#request_method ⇒ Object
20 21 22 |
# File 'lib/noder/http/request.rb', line 20 def request_method env[:request_method] end |
#request_uri ⇒ Object
32 33 34 |
# File 'lib/noder/http/request.rb', line 32 def request_uri env[:request_uri] end |