Expand description
Lightweight, per-test HTTP mock server for testing API integrations.
Spins up a real TCP server on a random port using raw tokio TCP — no external HTTP framework required. Each test gets its own isolated server instance.
§Example
use philiprehberger_mock_server::{MockServer, Method};
#[tokio::main]
async fn main() {
let server = MockServer::start().await;
server
.mock(Method::GET, "/hello")
.with_status(200)
.with_body("world")
.create();
println!("Mock server running at {}", server.url());
}Structs§
- Mock
Builder - Fluent builder for configuring a mock response.
- Mock
Server - A lightweight HTTP mock server bound to a random local port.
- Recorded
Request - A recorded incoming HTTP request.
Enums§
- Method
- HTTP method for mock matching.