yjp 1 anno fa
parent
commit
33c2063c12
1 ha cambiato i file con 11 aggiunte e 0 eliminazioni
  1. 11 0
      http_binding/request/request.go

+ 11 - 0
http_binding/request/request.go

@@ -50,3 +50,14 @@ func BindingForm[T any](c *binding_context.Context, request interface{}, sendFun
 
 	return true
 }
+
+func BindingXMLForm[T any](c *binding_context.Context, request interface{}, sendFunc response.SendFunc[T]) bool {
+	err := c.ShouldBindXML(request)
+	if err != nil {
+		var zero T
+		sendFunc(c, http.StatusBadRequest, zero, err)
+		return false
+	}
+
+	return true
+}