Skip to main content

mockserver_client/
lib.rs

1//! # mockserver-client
2//!
3//! An idiomatic Rust client for [MockServer](https://www.mock-server.com)'s
4//! control-plane REST API.
5//!
6//! This crate provides a blocking (synchronous) client that communicates with a
7//! running MockServer instance over HTTP. It supports creating expectations,
8//! verifying requests, clearing/resetting state, and retrieving recorded data.
9//!
10//! # Quick Start
11//!
12//! ```no_run
13//! use mockserver_client::{ClientBuilder, HttpRequest, HttpResponse};
14//!
15//! let client = ClientBuilder::new("localhost", 1080).build().unwrap();
16//!
17//! client.when(HttpRequest::new().method("GET").path("/hello"))
18//!     .respond(HttpResponse::new().status_code(200).body("world"))
19//!     .unwrap();
20//!
21//! client.verify(
22//!     HttpRequest::new().path("/hello"),
23//!     mockserver_client::VerificationTimes::at_least(1),
24//! ).unwrap();
25//!
26//! client.reset().unwrap();
27//! ```
28
29mod model;
30mod client;
31mod error;
32pub mod breakpoint;
33pub mod launcher;
34pub mod llm;
35pub mod mcp;
36
37pub use client::{ClientBuilder, MockServerClient, ForwardChainExpectation, Scenario};
38pub use error::{Error, Result};
39pub use model::*;
40pub use breakpoint::{
41    phase, BreakpointMatcherRegistration, BreakpointMatcherResponse,
42    BreakpointMatcherEntry, BreakpointMatcherList, PausedStreamFrame,
43    StreamFrameDecision, WsEnvelope, BreakpointRequestHandler,
44    BreakpointResponseHandler, BreakpointStreamFrameHandler, ObjectResponseHandler,
45    extract_header, set_header,
46    route_request, route_object_callback, route_response, route_stream_frame,
47};