axum-test-helper
exposes axum
original TestClient, which is private to the axum
crate
More information about this crate can be found in the crate documentation.
- Provide an easy to use interface
- Start a server in a different port for each call
- Deal with JSON, text and files response/requests
use axum::Router;
use axum::http::StatusCode;
use axum_test_helper::TestClient;
let app = Router::new().route("/", get(|| async {}));
let client = TestClient::new(app);
let res = client.get("/").send().await;
assert_eq!(res.status(), StatusCode::OK);
You can find examples like this in the example directory.
See the crate documentation for way more examples.
This project is licensed under the MIT license.