mod endpoint;
mod path_error;
mod router;
mod routes;
pub use endpoint::*;
pub use path_error::*;
pub use router::*;
pub use routes::*;
#[tokio::test]
async fn normalizes_nested_routes() -> Result<(), tower::BoxError> {
let mut context = Router::<()>::default();
context.insert("/hello", || async {})?;
context.insert("/", || async {})?;
let mut parent_context = Router::<()>::default();
parent_context.insert("/health", || async {})?;
parent_context.insert("", || async {})?;
parent_context.scope("/api", context)?;
assert_eq!(
parent_context.routes(),
vec!["/", "/api", "/api/hello", "/health"]
);
let frame = crate::Frame::message("/", (), ());
let _response = parent_context.handle_frame_with_state(frame, ()).await?;
Ok(())
}