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;
34
35pub use client::{ClientBuilder, MockServerClient, ForwardChainExpectation};
36pub use error::{Error, Result};
37pub use model::*;
38pub use breakpoint::{
39 phase, BreakpointMatcherRegistration, BreakpointMatcherResponse,
40 BreakpointMatcherEntry, BreakpointMatcherList, PausedStreamFrame,
41 StreamFrameDecision, WsEnvelope, BreakpointRequestHandler,
42 BreakpointResponseHandler, BreakpointStreamFrameHandler,
43 extract_header, set_header,
44 route_request, route_response, route_stream_frame,
45};