Skip to content

Commit

Permalink
Merge pull request #333 from pact-foundation/cuon-kakimoto-fix/sinatr…
Browse files Browse the repository at this point in the history
…a_4_1_x_host

Cuon kakimoto fix/sinatra 4 1 x host
  • Loading branch information
YOU54F authored Jan 20, 2025
2 parents add2922 + 1b1a8bf commit 0186680
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ jobs:
matrix:
ruby_version: ["2.7", "3.0", "3.1", "3.2", "3.3"]
os: ["ubuntu-latest","windows-latest","macos-latest"]
# defaults:
# run:
# shell: bash
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- run: "bundle exec rake"
- run: "bundle install && bundle exec rake spec"
if: matrix.ruby_version > '3.0'
working-directory: example/zoo-app
- run: "bundle install && bundle exec rake pact:verify"
if: matrix.os != 'windows-latest' && matrix.ruby_version > '3.0'
working-directory: example/animal-service
test-with-rack-2:
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -59,4 +62,4 @@ jobs:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- run: "bundle exec appraisal install"
- run: "bundle exec appraisal activesupport rake spec_with_active_support"
- run: "bundle exec appraisal activesupport rake spec_with_active_support"
8 changes: 5 additions & 3 deletions example/animal-service/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
PATH
remote: ../..
specs:
pact (1.65.3)
pact (1.66.0)
jsonpath (~> 1.0)
pact-mock_service (~> 3.0, >= 3.3.1)
pact-support (~> 1.16, >= 1.16.9)
pact-support (~> 1.19, >= 1.19.0)
rack-test (>= 0.6.3, < 3.0.0)
rainbow (~> 3.1)
rspec (~> 3.0)
string_pattern (~> 2.0)
thor (>= 0.20, < 2.0)

GEM
Expand Down Expand Up @@ -104,7 +106,7 @@ DEPENDENCIES
rake
rspec
sequel
sinatra (>= 4.0.0)
sinatra (>= 4.1.0)
sqlite3

BUNDLED WITH
Expand Down
12 changes: 10 additions & 2 deletions example/zoo-app/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
PATH
remote: ../..
specs:
pact (1.65.3)
pact (1.66.0)
jsonpath (~> 1.0)
pact-mock_service (~> 3.0, >= 3.3.1)
pact-support (~> 1.16, >= 1.16.9)
pact-support (~> 1.19, >= 1.19.0)
rack-test (>= 0.6.3, < 3.0.0)
rainbow (~> 3.1)
rspec (~> 3.0)
string_pattern (~> 2.0)
thor (>= 0.20, < 2.0)

GEM
Expand All @@ -27,8 +29,11 @@ GEM
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
json (2.8.2)
jsonpath (1.1.5)
multi_json
method_source (1.1.0)
mini_mime (1.1.5)
multi_json (1.15.0)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
ostruct (0.6.1)
Expand Down Expand Up @@ -66,6 +71,7 @@ GEM
rack (>= 3)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.10.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
Expand All @@ -79,6 +85,8 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
string_pattern (2.3.0)
regexp_parser (~> 2.5, >= 2.5.0)
sync (0.5.0)
table_print (1.5.7)
term-ansicolor (1.11.2)
Expand Down
2 changes: 1 addition & 1 deletion lib/pact/provider/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def body

def headers
request_headers = {}
request_headers.merge!('HTTP_HOST' => 'localhost') if defined?(Sinatra)
request_headers.merge!('HOST' => 'localhost') if defined?(Sinatra)
return request_headers if expected_request.headers.is_a?(Pact::NullExpectation)

expected_request.headers.each do |key, value|
Expand Down

0 comments on commit 0186680

Please sign in to comment.