httpclient

package module
v0.0.0-...-c50cb00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

README

httpclient

库作用

  • 对第三方接口发起请求

依赖基础库

配置说明

默认配置

  • AllowGetMethodPayload : 允许GET请求带Body, 默认值 true , 如需关闭, 可通过 HttpClient.GetRestyClient().SetAllowGetMethodPayload(false) 关闭

使用方式

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRestyClient

func NewRestyClient(reqConfig *define.Request) (*resty.Client, *resty.Request)

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

func NewHttpClient(reqConfig *define.Request, cacheInstance cache.ICache) (*HttpClient, error)

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

Directories

Path Synopsis
Package cache ...
Package cache ...
Package define ...
Package define ...
Package validate ...
Package validate ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL