支持设置path param value
This commit is contained in:
parent
bab271d562
commit
3504899a5d
8
resty.go
8
resty.go
@ -39,7 +39,13 @@ func NewRestyClient(reqConfig *define.Request) (*resty.Client, *resty.Request) {
|
||||
request.SetQueryParams(reqConfig.Query) // 设置query参数
|
||||
request.SetHeaders(reqConfig.Header) // 设置header
|
||||
request.URL = reqConfig.FullUrl // 请求接口
|
||||
request.Method = reqConfig.Method // 请求方法
|
||||
for pathParamName, pathParamValue := range reqConfig.PathParam {
|
||||
if len(pathParamValue) == 0 {
|
||||
continue
|
||||
}
|
||||
reqConfig.FullUrl = strings.ReplaceAll(reqConfig.FullUrl, "{#"+pathParamName+"#}", pathParamValue)
|
||||
}
|
||||
request.Method = reqConfig.Method // 请求方法
|
||||
cookieList := make([]*http.Cookie, 0)
|
||||
for cookieName, cookieValue := range reqConfig.Cookie {
|
||||
cookieList = append(cookieList, &http.Cookie{
|
||||
|
Loading…
Reference in New Issue
Block a user