http_client

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert2LogString

func Convert2LogString(object interface{}) string

func InitProxyMinio

func InitProxyMinio() error

func InitWorkflow

func InitWorkflow() error

func LogRpcJson

func LogRpcJson(ctx context.Context, business string, method string, params interface{}, result interface{}, err error, starTimestamp int64)

func SendRequest

func SendRequest(ctx context.Context, client *http.Client, httpRequestParams *HttpRequestParams, requestType string, buildRequest func(*HttpRequestParams, context.Context) (*http.Request, string, error)) (result []byte, err error)

SendRequest 此方法实现的目的是作为一个通用的http调用方法,也是最核心http调用

func SendRequestOriResp

func SendRequestOriResp(ctx context.Context, client *http.Client, httpRequestParams *HttpRequestParams, requestType string, buildRequest func(*HttpRequestParams, context.Context) (*http.Request, string, error)) (result *http.Response, err error)

SendRequestOriResp 此方法实现的目的是作为一个通用的http调用方法,也是最核心http调用

Types

type HttpClient

type HttpClient struct {
	Client *http.Client
}

func Create

func Create(client *http.Client) *HttpClient

func CreateDefault

func CreateDefault() *HttpClient

func ProxyMinio

func ProxyMinio() *HttpClient

func Workflow

func Workflow() *HttpClient

func (HttpClient) Delete

func (c HttpClient) Delete(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)

Delete 删除数据

func (HttpClient) Get

func (c HttpClient) Get(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)

func (HttpClient) PostFile

func (c HttpClient) PostFile(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)

func (HttpClient) PostForm

func (c HttpClient) PostForm(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)

func (HttpClient) PostJson

func (c HttpClient) PostJson(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)

func (HttpClient) PostJsonOriResp

func (c HttpClient) PostJsonOriResp(ctx context.Context, httpRequestParams *HttpRequestParams) (result *http.Response, err error)

PostJsonOriResp 此方法需要在外部设置content 超时,并进行defer cancel

type HttpRequestFileParams

type HttpRequestFileParams struct {
	FileName string
	FileData io.Reader
}

type HttpRequestParams

type HttpRequestParams struct {
	Headers    map[string]string
	Params     map[string]string
	Body       []byte
	FileParams []*HttpRequestFileParams
	Url        string
	Timeout    time.Duration
	MonitorKey string
	LogLevel   LogLevel
}

type LogLevel

type LogLevel int
const (
	LogNone   LogLevel = 0
	LogBasic  LogLevel = 1
	LogParams LogLevel = 2
	LogAll    LogLevel = 3
)

Jump to

Keyboard shortcuts

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