Class: Pact::Provider::Request::Replayable
- Inherits:
-
Object
- Object
- Pact::Provider::Request::Replayable
- Defined in:
- lib/pact/provider/request.rb
Instance Method Summary collapse
- #body ⇒ Object
- #headers ⇒ Object
-
#initialize(expected_request) ⇒ Replayable
constructor
A new instance of Replayable.
- #method ⇒ Object
- #path ⇒ Object
Constructor Details
#initialize(expected_request) ⇒ Replayable
Returns a new instance of Replayable.
10 11 12 |
# File 'lib/pact/provider/request.rb', line 10 def initialize expected_request @expected_request = expected_request end |
Instance Method Details
#body ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/pact/provider/request.rb', line 22 def body case expected_request.body when String then expected_request.body when NullExpectation then '' else reified_body end end |
#headers ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/pact/provider/request.rb', line 31 def headers request_headers = {} return request_headers if expected_request.headers.is_a?(Pact::NullExpectation) expected_request.headers.each do |key, value| key = key.upcase if key.match(/CONTENT.TYPE/) request_headers['CONTENT_TYPE'] = value else request_headers[formatted_request_header_key(key)] = value end end request_headers end |
#method ⇒ Object
14 15 16 |
# File 'lib/pact/provider/request.rb', line 14 def method expected_request.method end |
#path ⇒ Object
18 19 20 |
# File 'lib/pact/provider/request.rb', line 18 def path expected_request.full_path end |