httpClientV3

package
v1.64.27 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTPPHeaders added in v1.64.26

type HTPPHeaders struct {
	// contains filtered or unexported fields
}

func NewHTTPHeaders added in v1.64.26

func NewHTTPHeaders() *HTPPHeaders

type HTTPBuild added in v1.64.26

type HTTPBuild struct {
	// contains filtered or unexported fields
}

func (*HTTPBuild) GET added in v1.64.26

func (*HTTPBuild) GET(urlStr string, params *HTTPClientGetParam) (httpClient *HTTPClient, err error)

GET 获取 GET 请求

func (*HTTPBuild) GetAutoCopy added in v1.64.26

func (*HTTPBuild) GetAutoCopy() bool

GetAutoCopy 获取是否自动备份响应体

func (*HTTPBuild) GetTimeout added in v1.64.26

func (*HTTPBuild) GetTimeout() time.Duration

GetTimeout 获取超时

func (*HTTPBuild) GetTransport added in v1.64.26

func (*HTTPBuild) GetTransport() *http.Transport

GetTransport 获取 Transport

func (*HTTPBuild) SetAutoCopy added in v1.64.26

func (*HTTPBuild) SetAutoCopy(autoCopy bool) HTTPBuilder

SetAutoCopy 设置是否自动备份响应体

func (*HTTPBuild) SetRootURL added in v1.64.26

func (*HTTPBuild) SetRootURL(urls ...string) HTTPBuilder

SetRootURL 设置根路由

func (*HTTPBuild) SetTimeout added in v1.64.26

func (*HTTPBuild) SetTimeout(timeout time.Duration) HTTPBuilder

SetTimeout 设置超时

func (*HTTPBuild) SetTransport added in v1.64.26

func (*HTTPBuild) SetTransport(transport *http.Transport, cert []byte) (HTTPBuilder, error)

SetTransport 设置 Transport

type HTTPBuilder added in v1.64.26

type HTTPBuilder interface {
	SetRootURL(urls ...string) HTTPBuilder
	SetTransport(transport *http.Transport, cert []byte) (HTTPBuilder, error)
	GetTransport() *http.Transport
	SetTimeout(timeout time.Duration) HTTPBuilder
	GetTimeout() time.Duration
	SetAutoCopy(autoCopy bool) HTTPBuilder
	GetAutoCopy() bool
	GET(urlStr string, params *HTTPClientGetParam) (httpClient *HTTPClient, err error)
}

func OnceHTTPBuilder added in v1.64.26

func OnceHTTPBuilder() HTTPBuilder

OnceHTTPBuilder 获取单例对象

type HTTPClient

type HTTPClient struct {
	Error error

	OK *bool
	// contains filtered or unexported fields
}

func NewHTTPClientBasic added in v1.64.26

func NewHTTPClientBasic(httpBuilder HTTPBuilder, url string, headers map[string][]string) *HTTPClient

NewHTTPClientBasic http 客户端:实例化 → 基础

func NewHTTPClientDELETE added in v1.64.26

func NewHTTPClientDELETE(httpBuilder HTTPBuilder, url string, headers map[string][]string, body io.Reader) (httpClient *HTTPClient, err error)

NewHTTPClientDELETE http 客户端:实例化 → DELETE

func NewHTTPClientGET added in v1.64.26

func NewHTTPClientGET(httpBuilder HTTPBuilder, url string, headers map[string][]string) (httpClient *HTTPClient, err error)

NewHTTPClientGET http 客户端:实例化 → GET

func NewHTTPClientHEAD added in v1.64.26

func NewHTTPClientHEAD(httpBuilder HTTPBuilder, url string, headers map[string][]string, body io.Reader) (httpClient *HTTPClient, err error)

NewHTTPClientHEAD http 客户端:实例化 → HEAD

func NewHTTPClientNoGET added in v1.64.26

func NewHTTPClientNoGET(httpBuilder HTTPBuilder, url string, headers map[string][]string, method string, body io.Reader) (httpClient *HTTPClient, err error)

NewHTTPClientBasic http 客户端:实例化 → 基础,非 GET

func NewHTTPClientOPTIONS added in v1.64.26

func NewHTTPClientOPTIONS(httpBuilder HTTPBuilder, url string, headers map[string][]string, body io.Reader) (httpClient *HTTPClient, err error)

NewHTTPClientOPTIONS http 客户端:实例化 → OPTIONS

func NewHTTPClientPATCH added in v1.64.26

func NewHTTPClientPATCH(httpBuilder HTTPBuilder, url string, headers map[string][]string, body io.Reader) (httpClient *HTTPClient, err error)

NewHTTPClientPATCH http 客户端:实例化 → PATCH

func NewHTTPClientPOST added in v1.64.26

func NewHTTPClientPOST(httpBuilder HTTPBuilder, url string, headers map[string][]string, body io.Reader) (httpClient *HTTPClient, err error)

NewHTTPClientPOST http 客户端:实例化 → POST

func NewHTTPClientPUT added in v1.64.26

func NewHTTPClientPUT(httpBuilder HTTPBuilder, url string, headers map[string][]string, body io.Reader) (httpClient *HTTPClient, err error)

NewHTTPClientPUT http 客户端:实例化 → PUT

func (*HTTPClient) JSON added in v1.64.26

func (my *HTTPClient) JSON(ret any) *HTTPClient

JSON 获取 JSON 结果

func (*HTTPClient) Plain added in v1.64.26

func (my *HTTPClient) Plain() []byte

func (*HTTPClient) Send

func (my *HTTPClient) Send() *HTTPClient

Send 发送请求

func (*HTTPClient) SetAutoCopy added in v1.64.26

func (MY *HTTPClient) SetAutoCopy(autoCopy *bool) *HTTPClient

SetAutoCopy 设置超时

type HTTPClientGetParam added in v1.64.26

type HTTPClientGetParam struct {
	Queries     HTTPQuery
	Headers     map[string][]string
	Accept      string
	Body        io.Reader
	ContentType string
}

func NewHTTPClientParam added in v1.64.26

func NewHTTPClientParam() *HTTPClientGetParam

func (*HTTPClientGetParam) SetForm added in v1.64.26

func (my *HTTPClientGetParam) SetForm(body HTTPQuery) (*HTTPClientGetParam, error)

func (*HTTPClientGetParam) SetFormData added in v1.64.26

func (my *HTTPClientGetParam) SetFormData(body map[string]string) (*HTTPClientGetParam, error)

func (*HTTPClientGetParam) SetHeaders added in v1.64.26

func (my *HTTPClientGetParam) SetHeaders(headers map[string][]string) *HTTPClientGetParam

func (*HTTPClientGetParam) SetJSON added in v1.64.26

func (my *HTTPClientGetParam) SetJSON(body any) (*HTTPClientGetParam, error)

func (*HTTPClientGetParam) SetQueries added in v1.64.26

func (my *HTTPClientGetParam) SetQueries(queries HTTPQuery) *HTTPClientGetParam

func (*HTTPClientGetParam) SetXML added in v1.64.26

func (my *HTTPClientGetParam) SetXML(body any) (*HTTPClientGetParam, error)

func (*HTTPClientGetParam) SetYAML added in v1.64.26

func (my *HTTPClientGetParam) SetYAML(body any) (*HTTPClientGetParam, error)

type HTTPQuery added in v1.64.26

type HTTPQuery anyMap.AnyMapper[string, string]

Jump to

Keyboard shortcuts

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