axum-test-server 2.0.0

For spinning up and testing Axum servers
Documentation
mod test_server;
pub use self::test_server::*;

mod test_response;
pub use self::test_response::*;

pub mod util;

#[cfg(test)]
mod test {
    use super::*;

    use ::axum::routing::get;
    use ::axum::Router;

    async fn get_ping() -> &'static str {
        "pong!"
    }

    #[tokio::test]
    async fn it_sound_get() {
        // Build an application with a route.
        let app = Router::new()
            .route("/ping", get(get_ping))
            .into_make_service();

        // Run the server.
        let server = TestServer::new(app);

        // Get the request.
        server.get("/ping").await.assert_contents(&"pong!");
    }
}