Class: Cocaine::Http::Request
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(rq) ⇒ Request
constructor
A new instance of Request.
- #read ⇒ Object
Constructor Details
#initialize(rq) ⇒ Request
13 14 15 |
# File 'lib/cocaine/server/http.rb', line 13 def initialize(rq) @ch = rq.read end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
11 12 13 |
# File 'lib/cocaine/server/http.rb', line 11 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
11 12 13 |
# File 'lib/cocaine/server/http.rb', line 11 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
11 12 13 |
# File 'lib/cocaine/server/http.rb', line 11 def method @method end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
11 12 13 |
# File 'lib/cocaine/server/http.rb', line 11 def query @query end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
11 12 13 |
# File 'lib/cocaine/server/http.rb', line 11 def version @version end |
Instance Method Details
#read ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cocaine/server/http.rb', line 17 def read ch = Cocaine::Channel.new @ch.callback { |msg| @method, url, @version, headers, @body = MessagePack::unpack msg @headers = Hash[headers] tmp_query = URI.parse(url).query @query = tmp_query == nil ? {} : CGI.parse(tmp_query) ch.trigger self }.errback { |err| ch.error err } ch end |