mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-19 00:00:14 +02:00
Change Router::with_state and impl Service for Router<()> (#1552)
* Implement `Service` for `Router<(), B>` * wip * wip * fix some tests * fix examples * fix doc tests * clean up docs * changelog * fix * also call `with_state` when converting `MethodRouter` into a `MakeService` * suggestions from review
This commit is contained in:
@@ -61,7 +61,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn hello_world() {
|
||||
let app = app().into_service();
|
||||
let app = app();
|
||||
|
||||
// `Router` implements `tower::Service<Request<Body>>` so we can
|
||||
// call it like any tower service, no need to run an HTTP server.
|
||||
@@ -78,7 +78,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn json() {
|
||||
let app = app().into_service();
|
||||
let app = app();
|
||||
|
||||
let response = app
|
||||
.oneshot(
|
||||
@@ -103,7 +103,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn not_found() {
|
||||
let app = app().into_service();
|
||||
let app = app();
|
||||
|
||||
let response = app
|
||||
.oneshot(
|
||||
@@ -154,7 +154,7 @@ mod tests {
|
||||
// in multiple request
|
||||
#[tokio::test]
|
||||
async fn multiple_request() {
|
||||
let mut app = app().into_service();
|
||||
let mut app = app();
|
||||
|
||||
let request = Request::builder().uri("/").body(Body::empty()).unwrap();
|
||||
let response = app.ready().await.unwrap().call(request).await.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user