mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-27 00:00:24 +02:00
Support changing state type in #[debug_handler] (#1271)
* support setting body type for #[debug_handler] * Use lookahead1 to give better errors and detect duplicate arguments * fix docs link
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
use axum_macros::debug_handler;
|
||||
|
||||
#[debug_handler(body = BoxBody, body = BoxBody)]
|
||||
async fn handler() {}
|
||||
|
||||
#[debug_handler(state = (), state = ())]
|
||||
async fn handler_2() {}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,11 @@
|
||||
error: `body` specified more than once
|
||||
--> tests/debug_handler/fail/duplicate_args.rs:3:33
|
||||
|
|
||||
3 | #[debug_handler(body = BoxBody, body = BoxBody)]
|
||||
| ^^^^
|
||||
|
||||
error: `state` specified more than once
|
||||
--> tests/debug_handler/fail/duplicate_args.rs:6:29
|
||||
|
|
||||
6 | #[debug_handler(state = (), state = ())]
|
||||
| ^^^^^
|
||||
@@ -1,4 +1,4 @@
|
||||
error: unknown argument
|
||||
error: expected `body` or `state`
|
||||
--> tests/debug_handler/fail/invalid_attrs.rs:3:17
|
||||
|
|
||||
3 | #[debug_handler(foo)]
|
||||
|
||||
Reference in New Issue
Block a user