分离缓存读取与对后端接口的真是请求逻辑
This commit is contained in:
parent
4092863a9a
commit
8ef7aea4fe
10
client.go
10
client.go
@ -151,6 +151,16 @@ func (hc *HttpClient) Request() *define.Response {
|
|||||||
return cacheResult
|
return cacheResult
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return hc.requestBackendApi()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// requestBackendApi 请求后端接口
|
||||||
|
//
|
||||||
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
//
|
||||||
|
// Date : 18:47 2024/10/9
|
||||||
|
func (hc *HttpClient) requestBackendApi() *define.Response {
|
||||||
hc.Client.OnBeforeRequest(hc.getRequestValidateMiddleware()) // 请求参数验证中间件必注册
|
hc.Client.OnBeforeRequest(hc.getRequestValidateMiddleware()) // 请求参数验证中间件必注册
|
||||||
hc.Client.OnAfterResponse(hc.getResponseValidateMiddleware()) // 响应验证中间件必注册
|
hc.Client.OnAfterResponse(hc.getResponseValidateMiddleware()) // 响应验证中间件必注册
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user