mockserver-client 9.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/mockserver/a2a.rb +4 -3
- data/lib/mockserver/client.rb +4 -3
- data/lib/mockserver/mcp.rb +20 -3
- data/lib/mockserver/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3b414bb7cc138b2e2a46b674e67743d1145bc004bc7a62be5d25e75fab95409f
|
|
4
|
+
data.tar.gz: 8d11ed79c2d777ab576c4181e9cb2c6b2730c352afc532d5df4070e9accddaf6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0b346b83cbc825456b2dc85b6b1462e1fa3610f779f9037e77ba2f40f4a780e9c64a793d80df95dbceb0b7d67b57805cce281d75fa8ba36114edb7e35851892
|
|
7
|
+
data.tar.gz: 5bde30af6fe4e94208ac4a275e52309d77e1d78a94d74ce152c993a656e8db00d98adc88f9556c21f2c1d3939b180e2f7ac9588195a4462a9a99ab035883eaac
|
data/README.md
CHANGED
|
@@ -417,7 +417,7 @@ launcher_path = MockServer::BinaryLauncher.ensure_launcher
|
|
|
417
417
|
### Specify a version
|
|
418
418
|
|
|
419
419
|
```ruby
|
|
420
|
-
handle = MockServer::BinaryLauncher.start(port: 1080, version: '9.
|
|
420
|
+
handle = MockServer::BinaryLauncher.start(port: 1080, version: '9.1.0')
|
|
421
421
|
```
|
|
422
422
|
|
|
423
423
|
### API reference
|
data/lib/mockserver/a2a.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'uri'
|
|
5
|
+
require_relative 'mcp'
|
|
5
6
|
|
|
6
7
|
module MockServer
|
|
7
8
|
# Fluent builder for mocking an A2A (Agent-to-Agent) agent.
|
|
@@ -45,11 +46,11 @@ module MockServer
|
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
# Escape Velocity metacharacters so literal +$+ / +#+ survive rendering.
|
|
49
|
+
# Shares the MCP builder's rules (backslash runs before +$+, +#+ or the end
|
|
50
|
+
# of the value are escaped too).
|
|
48
51
|
# @api private
|
|
49
52
|
def self.escape_velocity(value)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
value.to_s.gsub('$', '${esc.d}').gsub('#', '${esc.h}')
|
|
53
|
+
MCP.escape_velocity(value)
|
|
53
54
|
end
|
|
54
55
|
|
|
55
56
|
# @api private
|
data/lib/mockserver/client.rb
CHANGED
|
@@ -912,14 +912,15 @@ module MockServer
|
|
|
912
912
|
#
|
|
913
913
|
# @param experiment [Hash, #to_h] the experiment definition
|
|
914
914
|
# @return [Hash] the started status, e.g. { "status" => "started", "name" => ... }
|
|
915
|
-
# @raise [Error] if the experiment definition is invalid
|
|
916
|
-
# (HTTP
|
|
915
|
+
# @raise [Error] if the experiment definition is invalid (HTTP 400), if
|
|
916
|
+
# control-plane authorization rejects the request (HTTP 403), or on any other
|
|
917
|
+
# failure; there is no server setting that disables chaos experiments
|
|
917
918
|
def start_chaos_experiment(experiment)
|
|
918
919
|
payload = experiment.respond_to?(:to_h) ? experiment.to_h : experiment
|
|
919
920
|
body = JSON.generate(payload)
|
|
920
921
|
status, response_body = request('PUT', '/mockserver/chaosExperiment', body)
|
|
921
922
|
if status == 403
|
|
922
|
-
raise Error,
|
|
923
|
+
raise Error, "Chaos experiment rejected (status=403): control-plane authorization denied: #{response_body}"
|
|
923
924
|
end
|
|
924
925
|
if status >= 400
|
|
925
926
|
raise Error, "Failed to start chaos experiment (status=#{status}): #{response_body}"
|
data/lib/mockserver/mcp.rb
CHANGED
|
@@ -31,20 +31,37 @@ module MockServer
|
|
|
31
31
|
quoted[1...-1]
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
VELOCITY_METACHARACTER_ESCAPES = { '$' => '${esc.d}', '#' => '${esc.h}' }.freeze
|
|
35
|
+
private_constant :VELOCITY_METACHARACTER_ESCAPES
|
|
36
|
+
|
|
34
37
|
# Escape Velocity metacharacters so literal +$+ / +#+ survive rendering.
|
|
38
|
+
# Velocity consumes backslashes written before a reference or directive, so
|
|
39
|
+
# a run of backslashes followed by +$+, +#+ or the end of the value is
|
|
40
|
+
# escaped too; other backslashes are literal to Velocity and left as-is.
|
|
35
41
|
# @api private
|
|
36
42
|
def self.escape_velocity(value)
|
|
37
43
|
return value if value.nil?
|
|
38
44
|
|
|
39
|
-
|
|
45
|
+
# group 2 consumes the metacharacter after a run, is empty at the end and
|
|
46
|
+
# unset (empty alternative) otherwise, so no lookaround is needed
|
|
47
|
+
value.to_s.gsub(/(\\+)(?:([$#]|\z)|)|[$#]/) do |match|
|
|
48
|
+
run = Regexp.last_match(1)
|
|
49
|
+
next VELOCITY_METACHARACTER_ESCAPES[match] if run.nil?
|
|
50
|
+
|
|
51
|
+
following = Regexp.last_match(2)
|
|
52
|
+
next run if following.nil?
|
|
53
|
+
|
|
54
|
+
('${esc.b}' * run.length) + VELOCITY_METACHARACTER_ESCAPES.fetch(following, '')
|
|
55
|
+
end
|
|
40
56
|
end
|
|
41
57
|
|
|
42
|
-
# Escape single quotes for safe inclusion inside a
|
|
58
|
+
# Escape backslashes, then single quotes, for safe inclusion inside a
|
|
59
|
+
# single-quoted JSONPath string literal.
|
|
43
60
|
# @api private
|
|
44
61
|
def self.escape_json_path(value)
|
|
45
62
|
return '' if value.nil?
|
|
46
63
|
|
|
47
|
-
value.to_s.gsub("'"
|
|
64
|
+
value.to_s.gsub('\\') { '\\\\' }.gsub("'") { "\\'" }
|
|
48
65
|
end
|
|
49
66
|
|
|
50
67
|
# Parse + re-serialize JSON (compact) to validate it. Raises on invalid JSON.
|
data/lib/mockserver/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mockserver-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 9.
|
|
4
|
+
version: 9.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Bloom
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: logger
|