yjp 1 rok pred
rodič
commit
33c2063c12
1 zmenil súbory, kde vykonal 11 pridanie a 0 odobranie
  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
+}