|
@@ -39,3 +39,14 @@ func BindingMultipartForm[O any](c *binding_context.Context, request any, sendFu
|
|
|
|
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func BindingForm[T any](c *binding_context.Context, request interface{}, sendFunc response.SendFunc[T]) bool {
|
|
|
|
+ err := c.ShouldBindWith(request, binding.Form)
|
|
|
|
+ if err != nil {
|
|
|
|
+ var zero T
|
|
|
|
+ sendFunc(c, http.StatusBadRequest, zero, err)
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true
|
|
|
|
+}
|