diff --git a/slhx-axum/src/lib.rs b/slhx-axum/src/lib.rs index b36e9bb..cc7e9c5 100644 --- a/slhx-axum/src/lib.rs +++ b/slhx-axum/src/lib.rs @@ -159,6 +159,10 @@ impl InteractionForm { } } + pub fn for_handle(handle: Handle, fields: impl IntoIterator) -> Self { + Self::new(handle.id().id, fields) + } + pub fn parse_urlencoded(body: &[u8]) -> Result { Self::from_parts(parse_urlencoded_pairs(body)?, Vec::new()) } diff --git a/slhx-axum/tests/response.rs b/slhx-axum/tests/response.rs index 7252230..77c872b 100644 --- a/slhx-axum/tests/response.rs +++ b/slhx-axum/tests/response.rs @@ -109,7 +109,7 @@ fn handler_registry_dispatches_by_checked_handle() { }); let response = registry - .dispatch(InteractionForm::new(create.id().id, [("title".into(), "Hello".into())])) + .dispatch(InteractionForm::for_handle(create, [("title".into(), "Hello".into())])) .unwrap(); assert_eq!(response.batch.fingerprint, BuildFingerprint(123));