mockserver-client 7.0.0 → 7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97517808097f2af911f727db3decbafcab8454285325b141ad5899a53af70be1
4
- data.tar.gz: 60b5bff4ef90906b229064f23b1593bec547dc428b9d93c61b387d29a2615dd0
3
+ metadata.gz: b853b4ba04e3473e6e664a0f1a2f6b4f0a8146f624a2308a19349fe94f536d9e
4
+ data.tar.gz: 848eedd40df3e43ac6299250c92d4f30ee1b7fbeedb15699cd7254af20fcb6a4
5
5
  SHA512:
6
- metadata.gz: d91bb153b43f523a60812dc4f100fb1e7deb04c6ddc6353266d632f8f074df3683e0292d9cd77efb464034e618d4e4d63fafc3b11b333c009098cc5b48b49684
7
- data.tar.gz: 7484d0dfa3e38edb7ad83dd2bb760a2b17dd2c4f474538e5673630f9fd28c056f4f7c2d2389ddbda2aa56f43eb052915cb4b5a432b4f15e7594e4db54cf92c9f
6
+ metadata.gz: a2c283e6f9ed9fb935ff296a84298abc7c73768609c0601b8079e20441ebd25ca1029256a7c21a968578ef3f9ea28777b7d07dd20c7d8b4387031298389c4eb8
7
+ data.tar.gz: 77bc8cf3f5e4e919ba758c4c720cbf9795600094d7bfc41faa66b5571c0ea2b7ee39fa3a4f6871726ffc3a6468f84defb34afce05b33203b734e1cc1ac1c3c53
data/README.md CHANGED
@@ -99,6 +99,110 @@ All 25 domain model classes are available under the `MockServer` module:
99
99
  - `Ports`
100
100
  - `RequestDefinition` (alias for `HttpRequest`)
101
101
 
102
+ ## Interactive Breakpoints
103
+
104
+ The client supports matcher-driven interactive breakpoints over the callback WebSocket. Register a breakpoint matcher to pause forwarded/proxied exchanges at specific phases and inspect/modify/continue them via callback handlers.
105
+
106
+ ### Register a breakpoint
107
+
108
+ ```ruby
109
+ client = MockServer::Client.new('localhost', 1080)
110
+
111
+ # REQUEST phase only
112
+ bp_id = client.add_request_breakpoint(
113
+ MockServer::HttpRequest.new(path: '/api/.*'),
114
+ ->(request) { request } # continue unchanged (or return HttpResponse to abort)
115
+ )
116
+
117
+ # REQUEST + RESPONSE
118
+ bp_id = client.add_request_and_response_breakpoint(
119
+ MockServer::HttpRequest.new(path: '/api/.*'),
120
+ ->(request) { request }, # REQUEST handler
121
+ ->(request, response) { response } # RESPONSE handler
122
+ )
123
+
124
+ # All phases with stream frame handler
125
+ bp_id = client.add_breakpoint(
126
+ MockServer::HttpRequest.new(path: '/stream/.*'),
127
+ %w[REQUEST RESPONSE RESPONSE_STREAM INBOUND_STREAM],
128
+ request_handler: ->(request) { request },
129
+ response_handler: ->(request, response) { response },
130
+ stream_frame_handler: ->(frame) { { 'action' => 'CONTINUE' } }
131
+ # Other actions: MODIFY (with body), DROP, INJECT (with body), CLOSE
132
+ )
133
+ ```
134
+
135
+ ### Manage breakpoints
136
+
137
+ ```ruby
138
+ # List all matchers
139
+ matchers = client.list_breakpoint_matchers # {"matchers" => [...]}
140
+
141
+ # Remove a specific matcher
142
+ client.remove_breakpoint_matcher(bp_id)
143
+
144
+ # Clear all matchers
145
+ client.clear_breakpoint_matchers
146
+ ```
147
+
148
+ ## Start / Launch MockServer
149
+
150
+ The Ruby client can download and launch a local MockServer instance directly -- no Java installation and no Docker required. The launcher downloads a self-contained platform bundle (`mockserver-<version>-<os>-<arch>`) from the GitHub Release, verifies its SHA-256, caches it per-user, and starts it.
151
+
152
+ ### Quick start
153
+
154
+ ```ruby
155
+ require 'mockserver-client'
156
+
157
+ # Download (first run) and start MockServer on port 1080
158
+ handle = MockServer::BinaryLauncher.start(port: 1080)
159
+ puts "MockServer running on port #{handle.port}, PID #{handle.pid}"
160
+
161
+ # ... use MockServer ...
162
+
163
+ handle.stop
164
+ ```
165
+
166
+ ### Just ensure the binary is present
167
+
168
+ ```ruby
169
+ launcher_path = MockServer::BinaryLauncher.ensure_launcher
170
+ ```
171
+
172
+ ### Specify a version
173
+
174
+ ```ruby
175
+ handle = MockServer::BinaryLauncher.start(port: 1080, version: '7.1.0')
176
+ ```
177
+
178
+ ### API reference
179
+
180
+ | Method / Class | Description |
181
+ |---|---|
182
+ | `MockServer::BinaryLauncher.ensure_launcher(version:, log:)` | Download, verify, cache, and return the launcher path. Defaults to `MockServer::VERSION`. |
183
+ | `MockServer::BinaryLauncher.start(port:, version:, extra_args:, log:)` | Ensure the binary and start MockServer. Returns a `ServerHandle`. |
184
+ | `MockServer::BinaryLauncher::ServerHandle` | Handle to the running process. Methods: `stop(timeout:)`, `running?`. Attributes: `pid`, `port`, `launcher`. |
185
+
186
+ ### Supported platforms
187
+
188
+ | OS | Architecture |
189
+ |---|---|
190
+ | Linux | x86_64, aarch64 |
191
+ | macOS (darwin) | x86_64, aarch64 |
192
+ | Windows | x86_64, aarch64 |
193
+
194
+ ### Environment variables
195
+
196
+ | Variable | Purpose |
197
+ |---|---|
198
+ | `MOCKSERVER_BINARY_BASE_URL` | Mirror host for the release assets (corporate / air-gapped networks) |
199
+ | `MOCKSERVER_BINARY_CACHE` | Override the cache directory (default: `~/.cache/mockserver/binaries` on Unix) |
200
+ | `MOCKSERVER_SKIP_BINARY_DOWNLOAD` | Fail instead of downloading (use with a pre-seeded cache in CI) |
201
+
202
+ ### Version
203
+
204
+ By default the launcher downloads the MockServer version matching this client gem (currently `MockServer::VERSION` from `lib/mockserver/version.rb`). Pass an explicit `version:` keyword to override.
205
+
102
206
  ## License
103
207
 
104
208
  Apache-2.0