Documentation
¶
Overview ¶
Package httpclient ...
Description : httpclient ...
Author : go_developer@163.com<白茶清欢>
Date : 2024-05-31 15:22
Package httpclient ...
Description : httpclient ...
Author : go_developer@163.com<白茶清欢>
Date : 2024-05-31 14:59
Index ¶
- func NewRestyClient(reqConfig *define.Request) (*resty.Client, *resty.Request)
- type HttpClient
- func (hc *HttpClient) GetRestyClient() *resty.Client
- func (hc *HttpClient) OnRequestFinish(handlerList ...define.RequestFinishHandler)
- func (hc *HttpClient) OnResponse4xx(handlerList ...define.Http4xxHandler)
- func (hc *HttpClient) OnResponse5xx(handlerList ...define.Http5xxHandler)
- func (hc *HttpClient) OnResponseBusinessError(handlerList ...define.HttpBusinessErrorHandler)
- func (hc *HttpClient) Request() *define.Response
- func (hc *HttpClient) SetRestyClient(restyClient *resty.Client)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRestyClient ¶
NewRestyClient 获取resty client
Author : go_developer@163.com<白茶清欢>
Date : 15:00 2024/5/31
Types ¶
type HttpClient ¶
type HttpClient struct { *resty.Client // contains filtered or unexported fields }
HttpClient 请求客户端
Author : go_developer@163.com<白茶清欢>
Date : 15:27 2024/5/31
func NewHttpClient ¶
NewHttpClient 获取http client
Author : go_developer@163.com<白茶清欢>
Date : 15:27 2024/5/31
func (*HttpClient) GetRestyClient ¶
func (hc *HttpClient) GetRestyClient() *resty.Client
GetRestyClient 获取 resty client
Author : go_developer@163.com<白茶清欢>
Date : 15:57 2024/5/31
func (*HttpClient) OnRequestFinish ¶
func (hc *HttpClient) OnRequestFinish(handlerList ...define.RequestFinishHandler)
OnRequestFinish 请求完成时间
Author : go_developer@163.com<白茶清欢>
Date : 18:36 2024/6/1
func (*HttpClient) OnResponse4xx ¶
func (hc *HttpClient) OnResponse4xx(handlerList ...define.Http4xxHandler)
OnResponse4xx 4xx处理逻辑
Author : go_developer@163.com<白茶清欢>
Date : 18:20 2024/6/1
func (*HttpClient) OnResponse5xx ¶
func (hc *HttpClient) OnResponse5xx(handlerList ...define.Http5xxHandler)
OnResponse5xx 5xx处理逻辑
Author : go_developer@163.com<白茶清欢>
Date : 18:21 2024/6/1
func (*HttpClient) OnResponseBusinessError ¶
func (hc *HttpClient) OnResponseBusinessError(handlerList ...define.HttpBusinessErrorHandler)
OnResponseBusinessError 业务错误出路逻辑
Author : go_developer@163.com<白茶清欢>
Date : 18:22 2024/6/1
func (*HttpClient) Request ¶
func (hc *HttpClient) Request() *define.Response
Request 发送请求
Author : go_developer@163.com<白茶清欢>
Date : 15:52 2024/5/31
func (*HttpClient) SetRestyClient ¶
func (hc *HttpClient) SetRestyClient(restyClient *resty.Client)
SetRestyClient 设置client
Author : go_developer@163.com<白茶清欢>
Date : 15:54 2024/5/31