The mockserver-client gem is a community-maintained Ruby client for MockServer. It provides a DSL for creating expectations, verifying requests, and managing server state.
The Ruby client is a community-maintained project, not an official
MockServer artifact. The canonical source and latest release information are
available on RubyGems.
Installation
Usage
The gem exposes two clients:
MockServer::MockServerClient — for interacting with MockServer (mocking)
MockServer::ProxyClient — for interacting with MockServer acting as a proxy
JSON-based API
The Ruby client mirrors the MockServer REST API. If the Ruby DSL does not cover a particular feature, you can submit raw expectation JSON directly via the REST API using any HTTP library:
To verify a request was received:
To reset all state:
REST API reference
All MockServer operations are available over HTTP. The full schema is documented in the REST API overview. The endpoints relevant to this guide are:
If you need features not yet available in the Ruby gem — such as OpenAPI
request matching, response templates, or callback actions — use the REST API
directly as shown above. Every feature MockServer supports is accessible via
HTTP.