Class: Pact::Provider::Request::Replayable
- Inherits:
-
Object
- Object
- Pact::Provider::Request::Replayable
- Defined in:
- lib/pact/provider/request.rb
Constant Summary collapse
- NO_HTTP_PREFIX =
["CONTENT-TYPE", "CONTENT-LENGTH"]
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
13 14 15 |
# File 'lib/pact/provider/request.rb', line 13 def initialize expected_request @expected_request = expected_request end |
Instance Method Details
#body ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/pact/provider/request.rb', line 25 def body case expected_request.body when String then expected_request.body when NullExpectation then '' else reified_body end end |
#headers ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/pact/provider/request.rb', line 34 def headers request_headers = {} return request_headers if expected_request.headers.is_a?(Pact::NullExpectation) expected_request.headers.each do |key, value| request_headers[rack_request_header_for(key)] = Pact::Reification.from_term(value) end request_headers end |
#method ⇒ Object
17 18 19 |
# File 'lib/pact/provider/request.rb', line 17 def method expected_request.method end |
#path ⇒ Object
21 22 23 |
# File 'lib/pact/provider/request.rb', line 21 def path expected_request.full_path end |