Class: HttpStub::Server::Request

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/http_stub/server/request.rb', line 6

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



6
7
8
# File 'lib/http_stub/server/request.rb', line 6

def headers
  @headers
end

#methodObject (readonly)

Returns the value of attribute method.



6
7
8
# File 'lib/http_stub/server/request.rb', line 6

def method
  @method
end

#parametersObject (readonly)

Returns the value of attribute parameters.



6
7
8
# File 'lib/http_stub/server/request.rb', line 6

def parameters
  @parameters
end

#uriObject (readonly)

Returns the value of attribute uri.



6
7
8
# File 'lib/http_stub/server/request.rb', line 6

def uri
  @uri
end