Expand description
On-demand binary launcher for MockServer.
Downloads the self-contained, JVM-less MockServer binary bundle for the current platform from a GitHub Release, verifies its SHA-256, caches it per-user, and launches it. No Java installation and no Docker required.
This is a faithful port of the reference implementation in
mockserver-node/downloadBinary.js.
§Environment overrides
| Variable | Purpose |
|---|---|
MOCKSERVER_BINARY_BASE_URL | Mirror host for the release assets (corporate / air-gapped) |
MOCKSERVER_BINARY_CACHE | Cache directory (default: per-OS user cache) |
MOCKSERVER_SKIP_BINARY_DOWNLOAD | Fail instead of downloading (air-gapped CI with a pre-seeded cache) |
HTTPS_PROXY / HTTP_PROXY | Honoured by the HTTP client for proxy routing |
Structs§
- Bundle
Name - The base name and extension of the bundle archive for the given version.
- Ensure
Options - Options for
ensure_binary. - Platform
- Resolved platform triple for the bundle file name.
- Server
Handle - A handle to a running MockServer process.
Enums§
- Launcher
Error - Errors specific to the binary launcher.
Constants§
- VERSION
- The MockServer version this client targets — derived from Cargo.toml at compile time.
Functions§
- asset_
url - Compute the download URL for a release asset.
- bundle_
base_ name - Compute the bundle base name for a given version on the current platform.
- cache_
dir - Resolve the binary cache base directory.
- ensure_
binary - Ensure the platform binary is present and return the launcher path, downloading + verifying + extracting + caching on first use.
- ensure_
launcher - Ensure the launcher binary is available and return its path.
- is_
snapshot - Returns
trueif the version string contains “-SNAPSHOT” (case-insensitive), indicating a pre-release snapshot build. - launcher_
path - The expected path to the launcher binary inside the extracted bundle.
- prune_
old_ versions - Remove old version directories from the cache base, keeping only the
current version (and at most one previous). Also removes leftover
.partand.sha256temp files. Safe: never deletes outside the cache dir; tolerates concurrent runs. - resolve_
platform - Map the current platform and architecture to the bundle naming tokens.
- sha256_
bytes - Compute the SHA-256 hex digest of a byte slice (used in tests).
- sha256_
file - Compute the SHA-256 hex digest of a file.
- start
- Download (if needed) and start a MockServer on the given port.
- start_
with_ version - Start a MockServer of the given version on the given port.
Type Aliases§
- Launcher
Result - Result type alias for launcher operations.