Skip to content

Commit

Permalink
!fix: use rack-reverse-proxy fix for rack 3 compat
Browse files Browse the repository at this point in the history
note using pr fix from unmaintained gem waterlink/rack-reverse-proxy#73
  • Loading branch information
YOU54F committed Nov 29, 2024
1 parent b812dc0 commit cfb6dff
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ if ENV['X_PACT_DEVELOPMENT']
gem "pact-message", path: '../pact-message-ruby'
gem "pact-support", path: '../pact-support'
end

if ENV['RACK_VERSION'] == '2'
gem 'rack-reverse-proxy'
else
gem 'rack-reverse-proxy', git: 'https://github.com/samedi/rack-reverse-proxy.git', ref: '06f21feb6afbbf902969c4f1df219df8f2080387'
end
10 changes: 7 additions & 3 deletions pact-provider-verifier.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'faraday', '~> 2.5'
gem.add_runtime_dependency 'faraday-retry', '~> 2.2'
gem.add_runtime_dependency 'json', '>1.8'
gem.add_runtime_dependency 'rack', '>= 3.0', '< 4.0'
gem.add_runtime_dependency 'rackup', '~> 2.0'

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-reverse-proxy'
gem.add_runtime_dependency 'rspec_junit_formatter', '~> 0.3'
gem.add_runtime_dependency 'ostruct'
Expand Down
2 changes: 1 addition & 1 deletion spec/support/provider-echo-host.ru
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ require 'json'

run -> (env) {
body = {"Host" => env['HTTP_HOST']}.to_json
[200, {"Content-Type" => "application/json"}, [body]]
[200, {"content-type" => "application/json"}, [body]]
}
2 changes: 1 addition & 1 deletion spec/support/provider_with_self_signed_cert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
def run_provider_with_self_signed_cert port
# trap 'INT' do @server.shutdown end
require 'rack'
require 'rack/handler/webrick'
require_relative 'webbrick'
require 'webrick/https'

webrick_opts = {:Port => port, :SSLEnable => true, :SSLCertName => [%w[CN localhost]]}
Expand Down
11 changes: 11 additions & 0 deletions spec/support/webbrick.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Rack
module Handler
begin
require 'rack/handler/webrick'
WEBrick = Class.new(Rack::Handler::WEBrick)
rescue LoadError
require 'rackup/handler/webrick'
WEBrick = Class.new(Rackup::Handler::WEBrick)
end
end
end

0 comments on commit cfb6dff

Please sign in to comment.