feat(axum): build forms from checked handles

Add InteractionForm::for_handle so tests and public integration code can construct dispatched forms from generated Handle<T> values instead of raw numeric handle ids.

req: ceremony/004

req: public_api/001
This commit is contained in:
slhx agent
2026-05-26 00:42:39 +02:00
parent 062c184e42
commit b2aa1760c5
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -159,6 +159,10 @@ impl InteractionForm {
}
}
pub fn for_handle<I>(handle: Handle<I>, fields: impl IntoIterator<Item = (String, String)>) -> Self {
Self::new(handle.id().id, fields)
}
pub fn parse_urlencoded(body: &[u8]) -> Result<Self, InteractionFormRejection> {
Self::from_parts(parse_urlencoded_pairs(body)?, Vec::new())
}
+1 -1
View File
@@ -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));