pact-mock_service 3.12.0 → 3.12.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8df83bcc8595050f2a3a625966e7d2e43b4c75cdc634dc95c8b67eb4b7358d93
4
- data.tar.gz: b09a1fc63348ec662c472353311c37036042093a40c6fe8f37561ab01fdbd11b
3
+ metadata.gz: '08233bef28db9357360423a4752f559c5c90dacb46fedbb0c04fa28d6c3ada69'
4
+ data.tar.gz: bcacff5aec9f076deaa872526118ceb87e4a2316d50929e7095998d0aa568664
5
5
  SHA512:
6
- metadata.gz: 60405d58990da42e85ea1853c6ff760ab2949f74fefe6af3b809e7b9e876102e9a63f59ec55c2319ed7d67cb5a0f1c9689a76c3e6404be283d0d3e7aeb95fbd1
7
- data.tar.gz: 73118d1f9c52a59e655753e0c5a96bb16143b15fe6333d67350379cc5566550cdc5365062d1ea4237364bc3b3ca4bad9201b90434a923403cd018aac6b60e421
6
+ metadata.gz: 364ea60f0b35a35cd4f0f26786bda252ac5a99d7dc102df2e6019da9c36bfba7f23eb1d6929f4233fefbc93de524d6f7d745e4170507d87ac0f841a5c75478f9
7
+ data.tar.gz: f40eb93146e58ffb7169889ac1baecd7ed35276ae3bb65742192559409ffa7fd5607951a413b913a520477acabe8c71c7848cd7a3eb8020a5df0b61c41b375b6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ <a name="v3.12.2"></a>
2
+ ### v3.12.2 (2024-06-15)
3
+
4
+ #### Bug Fixes
5
+
6
+ * Fix Rack 3 support ([f6b1869](/../../commit/f6b1869))
7
+ * Fix Rack > 3.0.0 support ([fab4a8f](/../../commit/fab4a8f))
8
+
9
+ <a name="v3.12.1"></a>
10
+ ### v3.12.1 (2023-10-19)
11
+
12
+ #### Bug Fixes
13
+
14
+ * use .read instead of .string for reading stream from rack.input ([000e3fd](/../../commit/000e3fd))
15
+
1
16
  <a name="v3.12.0"></a>
2
17
  ### v3.12.0 (2023-10-18)
3
18
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  # Pact Mock and Stub Service
3
3
 
4
- [![Build Status](https://travis-ci.com/pact-foundation/pact-mock_service.svg?branch=master)](https://travis-ci.com/pact-foundation/pact-mock_service)
4
+ [![Build Status](https://github.com/pact-foundation/pact-mock_service/actions/workflows/test.yml/badge.svg)](https://github.com/pact-foundation/pact-mock_service/actions/workflows/test.yml)
5
5
 
6
6
  This codebase provides the HTTP mock and stub service used by implementations of [Pact][pact]. It is packaged as a gem, and as a standalone executable for Mac OSX and Linux and Windows.
7
7
 
@@ -24,7 +24,7 @@ module Pact
24
24
  end
25
25
 
26
26
  request[:headers] = headers_from env
27
- body_string = request[:body].read
27
+ body_string = request[:body]&.read || ""
28
28
 
29
29
  if body_string.empty?
30
30
  request.delete :body
@@ -1,6 +1,7 @@
1
1
  require 'uri'
2
2
  require 'net/http'
3
3
  require 'rack'
4
+ require 'rack/handler/webbrick'
4
5
 
5
6
  # Copied shamelessly from Capybara
6
7
  # Used to run a mock service in a new thread when started by the AppManager or the ControlServer
@@ -66,11 +67,6 @@ module Pact
66
67
  end
67
68
 
68
69
  def run_default_server(app, port)
69
- begin
70
- require 'rack/handler/webrick'
71
- rescue LoadError
72
- require 'rackup/handler/webrick'
73
- end
74
70
  Rack::Handler::WEBrick.run(app, **webrick_opts) do |server|
75
71
  @port = server[:Port]
76
72
  end
@@ -1,5 +1,6 @@
1
1
  require 'pact/mock_service/control_server/app'
2
2
  require 'pact/mock_service/server/webrick_request_monkeypatch'
3
+ require 'rack/handler/webbrick'
3
4
 
4
5
  module Pact
5
6
  module MockService
@@ -23,7 +23,7 @@ module Pact
23
23
  end
24
24
 
25
25
  def respond env
26
- request_body = JSON.load(env['rack.input'].string)
26
+ request_body = JSON.load(env['rack.input'].read)
27
27
  parsing_options = { pact_specification_version: pact_specification_version }
28
28
  interactions = request_body['interactions'].collect { | hash | Interaction.from_hash(hash, parsing_options) }
29
29
  begin
@@ -25,7 +25,7 @@ module Pact
25
25
  end
26
26
 
27
27
  def respond env
28
- body = env['rack.input'].string
28
+ body = env['rack.input'].read
29
29
  consumer_contract_details = body.size > 0 ? JSON.parse(body, symbolize_names: true) : {}
30
30
  consumer_contract_params = default_options.merge(consumer_contract_details.merge(interactions: verified_interactions))
31
31
  consumer_contract_writer = ConsumerContractWriter.new(consumer_contract_params, logger)
@@ -5,6 +5,7 @@ require 'pact/mock_service/run'
5
5
  require 'pact/mock_service/server/webrick_request_monkeypatch'
6
6
  require 'pact/specification_version'
7
7
  require 'pact/support/metrics'
8
+ require 'rack/handler/webbrick'
8
9
 
9
10
  module Pact
10
11
  module MockService
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module MockService
3
- VERSION = "3.12.0"
3
+ VERSION = "3.12.2"
4
4
  end
5
5
  end
@@ -0,0 +1,12 @@
1
+ module Rack
2
+ module Handler
3
+ begin
4
+ require 'rack/handler/webrick'
5
+ WEBrick = Class.new(Rack::Handler::WEBrick)
6
+ rescue LoadError
7
+ require 'rackup/handler/webrick'
8
+ WEBrick = Class.new(Rackup::Handler::WEBrick)
9
+ end
10
+ end
11
+ end
12
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-mock_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.0
4
+ version: 3.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fraser
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2023-10-18 00:00:00.000000000 Z
15
+ date: 2024-06-15 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: '2.0'
23
+ version: '3.0'
24
24
  - - "<"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '3.0'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
36
  version: '4.0'
@@ -391,6 +391,7 @@ files:
391
391
  - lib/pact/stub_service/cli.rb
392
392
  - lib/pact/support/expand_file_list.rb
393
393
  - lib/pact/support/metrics.rb
394
+ - lib/rack/handler/webbrick.rb
394
395
  homepage: https://github.com/bethesque/pact-mock_service
395
396
  licenses:
396
397
  - MIT
@@ -410,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
410
411
  - !ruby/object:Gem::Version
411
412
  version: '0'
412
413
  requirements: []
413
- rubygems_version: 3.4.21
414
+ rubygems_version: 3.5.13
414
415
  signing_key:
415
416
  specification_version: 4
416
417
  summary: Provides a mock service for use with Pact