Expand description
TestClient for integration testing without network binding
This module provides a test client that allows sending simulated HTTP requests through the full middleware and handler pipeline without starting a real server.
§Example
ⓘ
use rustapi_core::{RustApi, get};
use rustapi_testing::TestClient;
async fn hello() -> &'static str {
"Hello, World!"
}
#[tokio::test]
async fn test_hello() {
let app = RustApi::new().route("/", get(hello));
let client = TestClient::new(app);
let response = client.get("/").await;
response.assert_status(200);
assert_eq!(response.text(), "Hello, World!");
}Structs§
- Test
Client - Test client for integration testing without network binding
- Test
Request - Test request builder
- Test
Response - Test response with assertion helpers