rift-mock-core
The engine behind Rift, a Mountebank-compatible mock server, as a library: imposter lifecycle and listeners (HTTP/1.1, HTTP/2, TLS and mutual TLS), stub matching, responses and behaviors, proxy record/replay, fault injection, Rhai and JavaScript scripting, response templates and flow state — with no CLI and no admin HTTP server.
The rift binary (rift-http-proxy) and the C ABI (rift-ffi) are thin consumers of this crate.
Depend on it directly when you want imposters inside a Rust process without the admin API:
use ;
let manager = new;
let config: ImposterConfig = from_str?;
let port = manager.create_imposter.await?; // port 0 is auto-assigned
ImposterManager is also the extension point. Its with_* builders take the SPI traits — flow
store, request journal, proxy-recording store, response sequencer, event listener, response
decorator, no-match interceptor, exchange inspector — and the built-in behaviour stays in place for
any you do not install. The engine ships only the in-memory flow store; any other store plugs in through
with_flow_store_provider.
Features
| Feature | Default | Effect |
|---|---|---|
javascript |
on | JavaScript (Boa) for inject, decorate and _rift.script |
quamina-matching |
on | Quamina-backed body-field candidate pruning; matching results are identical without it |
wasm |
off | engine: "wasm" for _rift.script: WebAssembly components under wasmtime |
Documentation
- Embedding & SPI — the crate map, the embeddable server and every SPI trait
- Concepts — the request lifecycle and the Rift model
- The
rift:mockWIT contract — the world a wasm_rift.scriptruns (wit/rift-mock.wit, shipped in this crate), every function's semantics, the compatibility policy and the conformance guest
License
Apache-2.0