Class: HttpCapture::Request
- Inherits:
-
Object
- Object
- HttpCapture::Request
- Defined in:
- lib/http_capture.rb
Overview
Represents a captured request.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(real_request) ⇒ Request
constructor
A new instance of Request.
-
#method ⇒ Object
The request method as an upper-case string.
-
#path ⇒ Object
The request path.
-
#uri ⇒ Object
The complete request URI.
Constructor Details
#initialize(real_request) ⇒ Request
Returns a new instance of Request.
9 10 11 |
# File 'lib/http_capture.rb', line 9 def initialize(real_request) @real_request = real_request end |
Instance Method Details
#method ⇒ Object
The request method as an upper-case string.
14 15 16 17 18 19 20 |
# File 'lib/http_capture.rb', line 14 def method if @real_request.respond_to?(:request_method) @real_request.request_method.to_s.upcase else @real_request.method.to_s.upcase end end |
#path ⇒ Object
The request path.
23 24 25 |
# File 'lib/http_capture.rb', line 23 def path @real_request.path end |
#uri ⇒ Object
The complete request URI.
28 29 30 31 32 33 34 35 36 |
# File 'lib/http_capture.rb', line 28 def uri uri = if @real_request.respond_to?(:uri) @real_request.uri else @real_request.url end uri = URI.parse(uri.to_s) unless uri.is_a?(URI) uri end |