Skip to content

Commit

Permalink
Merge pull request #153 from pact-foundation/revert-152-fix-rack-3-su…
Browse files Browse the repository at this point in the history
…pport

Revert "Fix Rack 3 support"
  • Loading branch information
YOU54F authored Jun 15, 2024
2 parents a2e2d27 + af6adc1 commit 9bfdd03
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 25 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ jobs:
matrix:
ruby_version: ["2.7", "3.0", "3.1", "3.2", "3.3"]
os: ["ubuntu-latest","windows-latest","macos-latest"]
rack_version: ["2", "3"]
runs-on: ${{ matrix.os }}
env:
RACK_VERSION: ${{ matrix.rack_version }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
Expand Down
2 changes: 1 addition & 1 deletion lib/pact/consumer/mock_service/rack_request_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def request_as_hash_from env
end

request[:headers] = headers_from env
body_string = request[:body]&.read || ""
body_string = request[:body].read

if body_string.empty?
request.delete :body
Expand Down
6 changes: 5 additions & 1 deletion lib/pact/consumer/server.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'uri'
require 'net/http'
require 'rack'
require 'rack/handler/webbrick'

# Copied shamelessly from Capybara
# Used to run a mock service in a new thread when started by the AppManager or the ControlServer
Expand Down Expand Up @@ -67,6 +66,11 @@ def responsive?
end

def run_default_server(app, port)
begin
require 'rack/handler/webrick'
rescue LoadError
require 'rackup/handler/webrick'
end
Rack::Handler::WEBrick.run(app, **webrick_opts) do |server|
@port = server[:Port]
end
Expand Down
1 change: 0 additions & 1 deletion lib/pact/mock_service/control_server/run.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'pact/mock_service/control_server/app'
require 'pact/mock_service/server/webrick_request_monkeypatch'
require 'rack/handler/webbrick'

module Pact
module MockService
Expand Down
1 change: 0 additions & 1 deletion lib/pact/mock_service/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require 'pact/mock_service/server/webrick_request_monkeypatch'
require 'pact/specification_version'
require 'pact/support/metrics'
require 'rack/handler/webbrick'

module Pact
module MockService
Expand Down
12 changes: 0 additions & 12 deletions lib/rack/handler/webbrick.rb

This file was deleted.

8 changes: 2 additions & 6 deletions pact-mock_service.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.license = 'MIT'

if ENV['RACK_VERSION'] == '2'
gem.add_runtime_dependency 'rack', '>= 2.0', '< 3.0'
else
gem.add_runtime_dependency 'rack', '>= 3.0', '< 4.0'
gem.add_runtime_dependency 'rackup', '~> 2.0'
end
gem.add_runtime_dependency 'rack', '>= 2.0', '< 4.0'
gem.add_runtime_dependency 'rackup', '~> 2.0'
gem.add_runtime_dependency 'rspec', '>=2.14'
gem.add_runtime_dependency 'find_a_port', '~> 1.0.1'
gem.add_runtime_dependency 'thor', '>= 0.19', '< 2.0'
Expand Down

0 comments on commit 9bfdd03

Please sign in to comment.