httpclient支持mesh请求 #2

Merged
zhangdeman merged 26 commits from feature/upgrade_httpclient into master 2025-04-01 12:16:20 +08:00
3 changed files with 7 additions and 7 deletions
Showing only changes of commit 17703d2521 - Show all commits

6
go.sum
View File

@ -1,13 +1,9 @@
git.zhangdeman.cn/gateway/validate v0.0.0-20250324092220-164ea6b3ac40 h1:LtTK4adOiI1QBRNPZqyZse8TdV41wRpr4TPHOXzlPJ0=
git.zhangdeman.cn/gateway/validate v0.0.0-20250324092220-164ea6b3ac40/go.mod h1:4/5H+6rOx7/gr6fS8eumTL1HVWIz1l6EslDwquI+6e0=
git.zhangdeman.cn/gateway/validate v0.0.0-20250329080338-97d87fe06967 h1:ksdHEPciNlqq/h/OSpF3YyiXZIvgcCP5Vo7rTFy0/Cs=
git.zhangdeman.cn/gateway/validate v0.0.0-20250329080338-97d87fe06967/go.mod h1:Bwb9ks9pUp0Em+7CDTCUfnI+o6jRxMLifSHICsWmWXU=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250328040304-7e4a6f9f148c h1:cl3gQGXQpJ8ugDs0C/hQLfcvF4lGBm5BeABLvROFDoM=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250328040304-7e4a6f9f148c/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
git.zhangdeman.cn/zhangdeman/dynamic-struct v0.0.0-20250323125506-1b217c0e4fee h1:ufokPLk1nUKk+N5fDm/uD82OKqQn0EP/CMN6lK+wslM=
git.zhangdeman.cn/zhangdeman/dynamic-struct v0.0.0-20250323125506-1b217c0e4fee/go.mod h1:HwmL/Vtn3T9T4w6Gh8RlXRQ5o/3YNGqgLIuwgTJB0Mg=
git.zhangdeman.cn/zhangdeman/json_filter v0.0.0-20250321103029-786c03293a28 h1:wzEv9TXimkXuvjIgLuU+JETmWzj3AjfS3JA2cvU51xM=
git.zhangdeman.cn/zhangdeman/json_filter v0.0.0-20250321103029-786c03293a28/go.mod h1:RHYpM8BsZg9CuK78oY0+/n3g4kHMXk04+Gj1Sfg6E3U=
git.zhangdeman.cn/zhangdeman/json_filter v0.0.0-20250329080213-587a9bbe9dbc h1:jqaoktpx+gLiBLGpW/X03ZZ+oIsrQIlvimLSaHQo0iA=
git.zhangdeman.cn/zhangdeman/json_filter v0.0.0-20250329080213-587a9bbe9dbc/go.mod h1:KuVC2+wQ4dXMgqy4RF+wrsDxa+FWYuc7x17Y+/2b1YE=
git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20240122104027-4928421213c0 h1:gUDlQMuJ4xNfP2Abl1Msmpa3fASLWYkNlqDFF/6GN0Y=
@ -38,8 +34,6 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8=
github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=

View File

@ -103,3 +103,7 @@ const (
FailBehaviorContinue = "continue" // 失败后继续请求
FailBehaviorError = "error" // 失败后终止请求
)
const (
CommonServiceAlias = "__COMMON__"
)

View File

@ -161,13 +161,15 @@ func (c *client) buildRequestParams(apiCfg *RequestConfigGroupItem) (map[string]
validateRuleList := make([]validate.StructField, 0)
for _, itemParam := range apiCfg.ParamRuleList {
arr := strings.Split(itemParam.Path, ".")
sourcePath := itemParam.SourceResultPath
sourcePath = fmt.Sprintf("%v.%v.%v", itemParam.SourceAlias, itemParam.SourceResultLocation, itemParam.SourceResultPath)
validateRuleList = append(validateRuleList, validate.StructField{
JsonTag: arr[len(arr)-1],
Type: itemParam.Type,
Required: false,
RuleList: nil,
DefaultValue: itemParam.DefaultValue,
SourcePath: fmt.Sprintf("%v.%v.%v", itemParam.SourceAlias, itemParam.SourceResultLocation, itemParam.SourceResultPath), // TODO : 公共参数特殊处理
SourcePath: sourcePath,
TargetPath: fmt.Sprintf("%v.%v", itemParam.Location, itemParam.Path),
Errmsg: "",
})