xxhttp

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: MulanPSL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

@auther fenglei

@auther fenglei

Index

Constants

View Source
const (
	HttpContentTypeJson       = "application/json"
	HttpContentTypeUrlEncoded = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func BuildParams

func BuildParams(contentType string, params interface{}, noUrlEncode ...bool) string

Types

type AntsParam

type AntsParam struct {
	Url  string
	Data interface{}
	//透传值
	Unvarnished interface{}
}

type AntsReqMessage

type AntsReqMessage struct {
	Code int
	Body string
	Err  error
	Url  string
	//透传值
	Unvarnished interface{}
}

ReqMessage 返回

type OpsHttpClient

type OpsHttpClient struct {
	Method      string
	IsWan       bool            //是否外网
	TimeOut     time.Duration   //超时时间
	ContentType string          //头类型
	HeaderMap   *gmap.StrStrMap //header Map
	Attempts    uint            //重试次数
	Delay       time.Duration   // 每次重试间隔10秒
	DownFileMax int
}

func NewHttpClient

func NewHttpClient() *OpsHttpClient

func (*OpsHttpClient) AntsHttp

func (e *OpsHttpClient) AntsHttp(params []*AntsParam, PoolNum int) *garray.Array

func (*OpsHttpClient) HttpFileDownRequest

func (e *OpsHttpClient) HttpFileDownRequest(url, filePath string) error

func (*OpsHttpClient) HttpRequest

func (e *OpsHttpClient) HttpRequest(postUrl string, data ...interface{}) (message ReqMessage)

HttpPostRequest post请求

func (*OpsHttpClient) HttpRequestRetry

func (e *OpsHttpClient) HttpRequestRetry(postUrl string, data ...interface{}) (message ReqMessage)

func (*OpsHttpClient) HttpRequestRetryParam

func (e *OpsHttpClient) HttpRequestRetryParam(postUrl string, attempts uint, delay time.Duration, data ...interface{}) (messgae ReqMessage)

type ReqMessage

type ReqMessage struct {
	Code int
	Body string
	Err  error
}

ReqMessage 返回

type TBaseResults

type TBaseResults struct {
	B       bool
	Code    string      `json:"code"`
	Message string      `json:"message"`
	Result  interface{} `json:"result"`
}

func HttpInterfaceReq

func HttpInterfaceReq(postUrl string, data ...interface{}) (t *TBaseResults)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳