Class: Philiprehberger::HttpMock::Request
- Inherits:
-
Object
- Object
- Philiprehberger::HttpMock::Request
- Defined in:
- lib/philiprehberger/http_mock/request.rb
Overview
Represents a recorded HTTP request
Instance Attribute Summary collapse
-
#body ⇒ String?
readonly
The request body.
-
#headers ⇒ Hash
readonly
The request headers.
-
#method ⇒ Symbol
readonly
The HTTP method (:get, :post, etc.).
-
#url ⇒ String
readonly
The request URL.
Instance Method Summary collapse
-
#initialize(method:, url:, headers: {}, body: nil) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(method:, url:, headers: {}, body: nil) ⇒ Request
Returns a new instance of Request.
23 24 25 26 27 28 |
# File 'lib/philiprehberger/http_mock/request.rb', line 23 def initialize(method:, url:, headers: {}, body: nil) @method = method @url = url @headers = headers @body = body end |
Instance Attribute Details
#body ⇒ String? (readonly)
Returns the request body.
17 18 19 |
# File 'lib/philiprehberger/http_mock/request.rb', line 17 def body @body end |
#headers ⇒ Hash (readonly)
Returns the request headers.
14 15 16 |
# File 'lib/philiprehberger/http_mock/request.rb', line 14 def headers @headers end |
#method ⇒ Symbol (readonly)
Returns the HTTP method (:get, :post, etc.).
8 9 10 |
# File 'lib/philiprehberger/http_mock/request.rb', line 8 def method @method end |
#url ⇒ String (readonly)
Returns the request URL.
11 12 13 |
# File 'lib/philiprehberger/http_mock/request.rb', line 11 def url @url end |