Class: HttpStub::Server::Request
- Inherits:
-
Object
- Object
- HttpStub::Server::Request
- Defined in:
- lib/http_stub/server/request.rb
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.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(request) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(request) ⇒ Request
Returns a new instance of Request.
8 9 10 11 12 13 14 |
# File 'lib/http_stub/server/request.rb', line 8 def initialize(request) @uri = request.path_info @method = request.request_method.downcase @headers = HttpStub::Server::FormattedHash.new(HttpStub::Server::HeaderParser.parse(request), ":") @parameters = HttpStub::Server::FormattedHash.new(request.params, "=") @body = request.body.read end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/http_stub/server/request.rb', line 6 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/http_stub/server/request.rb', line 6 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/http_stub/server/request.rb', line 6 def method @method end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
6 7 8 |
# File 'lib/http_stub/server/request.rb', line 6 def parameters @parameters end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
6 7 8 |
# File 'lib/http_stub/server/request.rb', line 6 def uri @uri end |