From b2aa1760c5713690ed89ca4f5a10324db6067715 Mon Sep 17 00:00:00 2001 From: slhx agent Date: Tue, 26 May 2026 00:42:39 +0200 Subject: [PATCH] feat(axum): build forms from checked handles Add InteractionForm::for_handle so tests and public integration code can construct dispatched forms from generated Handle values instead of raw numeric handle ids. req: ceremony/004 req: public_api/001 --- slhx-axum/src/lib.rs | 4 ++++ slhx-axum/tests/response.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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));