mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-06 00:00:17 +02:00
Support extracting URL params multiple times (#15)
Useful when building higher order extractors.
This commit is contained in:
@@ -271,6 +271,30 @@ async fn extracting_url_params() {
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn extracting_url_params_multiple_times() {
|
||||
let app = route(
|
||||
"/users/:id",
|
||||
get(
|
||||
|_: extract::UrlParams<(i32,)>,
|
||||
_: extract::UrlParamsMap,
|
||||
_: extract::UrlParams<(i32,)>,
|
||||
_: extract::UrlParamsMap| async {},
|
||||
),
|
||||
);
|
||||
|
||||
let addr = run_in_background(app).await;
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
|
||||
let res = client
|
||||
.get(format!("http://{}/users/42", addr))
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn boxing() {
|
||||
let app = route(
|
||||
|
||||
Reference in New Issue
Block a user