Test Client
PrismTestClient lets you test routes and middleware without network I/O — requests go directly through the router. No port binding, no TCP connections, no flaky tests from race conditions.
Quick Start
Build and Test
Building a Test Client
PrismTestClientBuilder uses a fluent API to register routes and middleware:
Builder API
HTTP Methods
The client has convenience methods for all HTTP methods:All Methods
Testing with Middleware
Middleware Testing
Sending Custom Headers
Headers
Posting JSON
JSON Body
Full Test Example
Complete Test Suite
PrismTestClient bypasses all network code — it calls the router directly. This means TLS, connection handling, and HTTP parsing are not tested. For end-to-end tests, start a real server on a random port.