修复合并statis参数实际过晚导致参数不生效的问题
This commit is contained in:
parent
f696c0e871
commit
b33afff40c
@ -9,6 +9,10 @@ package httpclient
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.zhangdeman.cn/zhangdeman/consts"
|
"git.zhangdeman.cn/zhangdeman/consts"
|
||||||
"git.zhangdeman.cn/zhangdeman/network/httpclient/cache"
|
"git.zhangdeman.cn/zhangdeman/network/httpclient/cache"
|
||||||
"git.zhangdeman.cn/zhangdeman/network/httpclient/define"
|
"git.zhangdeman.cn/zhangdeman/network/httpclient/define"
|
||||||
@ -17,9 +21,6 @@ import (
|
|||||||
"git.zhangdeman.cn/zhangdeman/serialize"
|
"git.zhangdeman.cn/zhangdeman/serialize"
|
||||||
"github.com/go-resty/resty/v2"
|
"github.com/go-resty/resty/v2"
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewHttpClient 获取http client
|
// NewHttpClient 获取http client
|
||||||
@ -35,17 +36,6 @@ func NewHttpClient(reqConfig *define.Request, cacheInstance cache.ICache) (*Http
|
|||||||
if err := validate.RequestConfig(reqConfig); nil != err {
|
if err := validate.RequestConfig(reqConfig); nil != err {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
restyClient, restyRequest := NewRestyClient(reqConfig)
|
|
||||||
hc := &HttpClient{
|
|
||||||
Client: restyClient,
|
|
||||||
request: restyRequest,
|
|
||||||
reqConfig: reqConfig,
|
|
||||||
http4xxHandler: make([]define.Http4xxHandler, 0),
|
|
||||||
http5xxHandler: make([]define.Http5xxHandler, 0),
|
|
||||||
httpBusinessErrorHandler: make([]define.HttpBusinessErrorHandler, 0),
|
|
||||||
requestFinishHandler: make([]define.RequestFinishHandler, 0),
|
|
||||||
cacheInstance: cacheInstance,
|
|
||||||
}
|
|
||||||
if len(reqConfig.Static) > 0 {
|
if len(reqConfig.Static) > 0 {
|
||||||
for loc, valMap := range reqConfig.Static {
|
for loc, valMap := range reqConfig.Static {
|
||||||
if len(valMap) == 0 {
|
if len(valMap) == 0 {
|
||||||
@ -84,6 +74,17 @@ func NewHttpClient(reqConfig *define.Request, cacheInstance cache.ICache) (*Http
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
restyClient, restyRequest := NewRestyClient(reqConfig)
|
||||||
|
hc := &HttpClient{
|
||||||
|
Client: restyClient,
|
||||||
|
request: restyRequest,
|
||||||
|
reqConfig: reqConfig,
|
||||||
|
http4xxHandler: make([]define.Http4xxHandler, 0),
|
||||||
|
http5xxHandler: make([]define.Http5xxHandler, 0),
|
||||||
|
httpBusinessErrorHandler: make([]define.HttpBusinessErrorHandler, 0),
|
||||||
|
requestFinishHandler: make([]define.RequestFinishHandler, 0),
|
||||||
|
cacheInstance: cacheInstance,
|
||||||
|
}
|
||||||
return hc, nil
|
return hc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user