Skip to content

Commit

Permalink
fix: add HTTPS_HOST header if invoking a Sinatra app
Browse files Browse the repository at this point in the history
affects sinatra users 4.1.x post sinatra/sinatra#2053
  • Loading branch information
YOU54F committed Nov 29, 2024
1 parent de1f3c7 commit ed44189
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 67 deletions.
71 changes: 32 additions & 39 deletions example/animal-service/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
PATH
remote: ../..
specs:
pact (1.64.0)
pact (1.65.3)
pact-mock_service (~> 3.0, >= 3.3.1)
pact-support (~> 1.16, >= 1.16.9)
rack-test (>= 0.6.3, < 3.0.0)
rainbow (~> 3.1)
rspec (~> 3.0)
term-ansicolor (~> 1.7)
thor (>= 0.20, < 2.0)
webrick (~> 1.8)

GEM
remote: https://rubygems.org/
Expand All @@ -21,14 +20,16 @@ GEM
expgen (0.1.1)
parslet
find_a_port (1.0.1)
json (2.7.2)
json (2.8.2)
jsonpath (1.1.5)
multi_json
logger (1.6.1)
method_source (1.1.0)
mini_portile2 (2.8.7)
mize (0.4.1)
protocol (~> 2.0)
mustermann (3.0.0)
mini_portile2 (2.8.8)
multi_json (1.15.0)
mustermann (3.0.3)
ruby2_keywords (~> 0.0.1)
pact-mock_service (3.12.2)
pact-mock_service (3.12.3)
find_a_port (~> 1.0.1)
json
pact-support (~> 1.16, >= 1.16.4)
Expand All @@ -37,69 +38,61 @@ GEM
rspec (>= 2.14)
thor (>= 0.19, < 2.0)
webrick (~> 1.8)
pact-support (1.20.0)
pact-support (1.21.0)
awesome_print (~> 1.9)
diff-lcs (~> 1.5)
expgen (~> 0.1)
jsonpath (~> 1.0)
rainbow (~> 3.1.1)
string_pattern (~> 2.0)
parslet (2.0.0)
protocol (2.0.0)
ruby_parser (~> 3.0)
pry (0.14.2)
pry (0.15.0)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.8.0)
rack (3.1.7)
rack-protection (4.0.0)
rack (3.1.8)
rack-protection (4.1.1)
base64 (>= 0.1.0)
logger (>= 1.6.0)
rack (>= 3.0.0, < 4)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
rackup (2.2.1)
rack (>= 3)
webrick (~> 1.8)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.1)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
ruby2_keywords (0.0.5)
ruby_parser (3.21.0)
racc (~> 1.5)
sexp_processor (~> 4.16)
sequel (5.81.0)
sequel (5.86.0)
bigdecimal
sexp_processor (4.17.1)
sinatra (4.0.0)
sinatra (4.1.1)
logger (>= 1.6.0)
mustermann (~> 3.0)
rack (>= 3.0.0, < 4)
rack-protection (= 4.0.0)
rack-protection (= 4.1.1)
rack-session (>= 2.0.0, < 3)
tilt (~> 2.0)
sqlite3 (2.0.2)
sqlite3 (2.3.1)
mini_portile2 (~> 2.8.0)
sync (0.5.0)
term-ansicolor (1.10.2)
mize
tins (~> 1.0)
thor (1.3.1)
tilt (2.3.0)
tins (1.33.0)
bigdecimal
sync
webrick (1.8.1)
string_pattern (2.3.0)
regexp_parser (~> 2.5, >= 2.5.0)
thor (1.3.2)
tilt (2.4.0)
webrick (1.9.0)

PLATFORMS
ruby
Expand Down
46 changes: 18 additions & 28 deletions example/zoo-app/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
PATH
remote: ../..
specs:
pact (1.64.0)
pact (1.65.3)
pact-mock_service (~> 3.0, >= 3.3.1)
pact-support (~> 1.16, >= 1.16.9)
rack-test (>= 0.6.3, < 3.0.0)
rainbow (~> 3.1)
rspec (~> 3.0)
term-ansicolor (~> 1.7)
thor (>= 0.20, < 2.0)
webrick (~> 1.8)

GEM
remote: https://rubygems.org/
Expand All @@ -27,14 +26,13 @@ GEM
csv
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
json (2.7.2)
json (2.8.2)
method_source (1.1.0)
mini_mime (1.1.5)
mize (0.4.1)
protocol (~> 2.0)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
pact-mock_service (3.12.2)
ostruct (0.6.1)
pact-mock_service (3.12.3)
find_a_port (~> 1.0.1)
json
pact-support (~> 1.16, >= 1.16.4)
Expand All @@ -43,61 +41,53 @@ GEM
rspec (>= 2.14)
thor (>= 0.19, < 2.0)
webrick (~> 1.8)
pact-support (1.20.0)
pact-support (1.20.2)
awesome_print (~> 1.9)
diff-lcs (~> 1.5)
expgen (~> 0.1)
rainbow (~> 3.1.1)
pact_broker-client (1.75.3)
pact_broker-client (1.77.0)
base64 (~> 0.2)
dig_rb (~> 1.0)
httparty (>= 0.21.0, < 1.0.0)
ostruct
rake (~> 13.0)
table_print (~> 1.5)
term-ansicolor (~> 1.7)
thor (>= 0.20, < 2.0)
parslet (2.0.0)
protocol (2.0.0)
ruby_parser (~> 3.0)
pry (0.14.2)
pry (0.15.0)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.8.0)
rack (3.1.7)
rack (3.1.8)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
rackup (2.2.1)
rack (>= 3)
webrick (~> 1.8)
rainbow (3.1.1)
rake (13.2.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.1)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
ruby_parser (3.21.0)
racc (~> 1.5)
sexp_processor (~> 4.16)
sexp_processor (4.17.1)
sync (0.5.0)
table_print (1.5.7)
term-ansicolor (1.10.2)
mize
term-ansicolor (1.11.2)
tins (~> 1.0)
thor (1.3.1)
tins (1.33.0)
thor (1.3.2)
tins (1.37.0)
bigdecimal
sync
webrick (1.8.1)
webrick (1.9.0)

PLATFORMS
ruby
Expand Down
1 change: 1 addition & 0 deletions lib/pact/provider/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def body

def headers
request_headers = {}
request_headers.merge!('HTTP_HOST' => 'localhost') if defined?(Sinatra)
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)
Expand Down

0 comments on commit ed44189

Please sign in to comment.