yjp 1 жил өмнө
parent
commit
33c2063c12

+ 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
+}