File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package handlers
1818import (
1919 "github.com/go-openapi/runtime/middleware"
2020 client_native "github.com/haproxytech/client-native/v6"
21+ client_conf "github.com/haproxytech/client-native/v6/configuration"
2122 "github.com/haproxytech/client-native/v6/models"
2223 cn "github.com/haproxytech/dataplaneapi/client-native"
2324 "github.com/haproxytech/dataplaneapi/haproxy"
@@ -82,6 +83,13 @@ func (h *ReplaceGlobalHandlerImpl) Handle(params global.ReplaceGlobalParams, pri
8283 }
8384 return global .NewReplaceGlobalDefault (int (* e .Code )).WithPayload (e )
8485 }
86+ // validate constraints that can not be validated by the swagger 2.0 spec.
87+ if err := client_conf .ValidateGlobalSection (params .Data ); err != nil {
88+ code := misc .ErrHTTPBadRequest
89+ msg := err .Error ()
90+ e := & models.Error {Code : & code , Message : & msg }
91+ return global .NewReplaceGlobalDefault (int (misc .ErrHTTPBadRequest )).WithPayload (e )
92+ }
8593
8694 err := h .pushGlobalConfiguration (params , t , v )
8795 if err != nil {
You can’t perform that action at this time.
0 commit comments