修复path param处理的BUG
This commit is contained in:
parent
ba47891d3c
commit
e02ee1fef9
@ -59,12 +59,8 @@ func NewRestyClient(reqConfig *define.Request) (*resty.Client, *resty.Request) {
|
||||
}
|
||||
request.SetHeaders(header) // 设置header
|
||||
request.URL = reqConfig.FullUrl // 请求接口
|
||||
for pathParamName, pathParamValue := range reqConfig.PathParam {
|
||||
if len(pathParamValue) == 0 {
|
||||
continue
|
||||
}
|
||||
reqConfig.FullUrl = strings.ReplaceAll(reqConfig.FullUrl, "{"+pathParamName+"}", pathParamValue)
|
||||
}
|
||||
// 设置url参数, url path格式需要是 /user/{user_id}/detail格式, {user_id} 会自动替换
|
||||
request.SetPathParams(reqConfig.PathParam)
|
||||
request.Method = reqConfig.Method // 请求方法
|
||||
cookieList := make([]*http.Cookie, 0)
|
||||
for cookieName, cookieValue := range reqConfig.Cookie {
|
||||
@ -81,7 +77,7 @@ func NewRestyClient(reqConfig *define.Request) (*resty.Client, *resty.Request) {
|
||||
return client, request
|
||||
}
|
||||
|
||||
// setRestyBody 设置请求BODY
|
||||
// setRestyBody 设置请求BODY TODO: 支持xml / yml等
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user