httpClientV2

package
v1.56.9 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ContentTypeJSON               ContentType = "json"
	ContentTypeXML                ContentType = "xml"
	ContentTypeXWwwFormURLencoded ContentType = "form"
	ContentTypeFormData           ContentType = "form-data"
	ContentTypePlain              ContentType = "plain"
	ContentTypeHTML               ContentType = "html"
	ContentTypeCSS                ContentType = "css"
	ContentTypeJavascript         ContentType = "javascript"
	ContentTypeSteam              ContentType = "steam"

	ContentTypes = map[ContentType]string{
		ContentTypeJSON:               "application/json",
		ContentTypeXML:                "application/xml",
		ContentTypeXWwwFormURLencoded: "application/x-www-form-urlencoded",
		ContentTypeFormData:           "form-data",
		ContentTypePlain:              "text/plain",
		ContentTypeHTML:               "text/html",
		ContentTypeCSS:                "text/css",
		ContentTypeJavascript:         "text/javascript",
		ContentTypeSteam:              "application/octet-stream",
	}

	AcceptJSON       Accept = "json"
	AcceptXML        Accept = "xml"
	AcceptPlain      Accept = "plain"
	AcceptHTML       Accept = "html"
	AcceptCSS        Accept = "css"
	AcceptJavascript Accept = "javascript"
	AcceptSteam      Accept = "steam"
	AcceptAny        Accept = "any"

	Accepts = map[Accept]string{
		AcceptJSON:       "application/json",
		AcceptXML:        "application/xml",
		AcceptPlain:      "text/plain",
		AcceptHTML:       "text/html",
		AcceptCSS:        "text/css",
		AcceptJavascript: "text/javascript",
		AcceptSteam:      "application/octet-stream",
		AcceptAny:        "*/*",
	}
)
View Source
var APP struct {
	HTTPClient        HTTPClient
	HTTPClientBuilder HTTPClientBuilder
}

Functions

This section is empty.

Types

type Accept

type Accept string

type AttrAppendHeaderValue

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

func AppendHeaderValue

func AppendHeaderValue(headers map[string]any) *AttrAppendHeaderValue

func (*AttrAppendHeaderValue) Accept

func (*AttrAppendHeaderValue) Append

func (my *AttrAppendHeaderValue) Append(headers map[string]any) *AttrAppendHeaderValue

func (*AttrAppendHeaderValue) AppendOne

func (my *AttrAppendHeaderValue) AppendOne(key string, value any) *AttrAppendHeaderValue

func (*AttrAppendHeaderValue) Authorization

func (my *AttrAppendHeaderValue) Authorization(username, password, title string) *AttrAppendHeaderValue

func (*AttrAppendHeaderValue) ContentType

func (my *AttrAppendHeaderValue) ContentType(contentType ContentType) *AttrAppendHeaderValue

func (*AttrAppendHeaderValue) Error

func (my *AttrAppendHeaderValue) Error() error

func (*AttrAppendHeaderValue) ImplHTTPClientAttributer

func (*AttrAppendHeaderValue) ImplHTTPClientAttributer()

func (*AttrAppendHeaderValue) Register

func (my *AttrAppendHeaderValue) Register(req *HTTPClient)

type AttrAppendHeaderValues

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

func AppendHeaderValues

func AppendHeaderValues(headers map[string][]any) *AttrAppendHeaderValues

func (*AttrAppendHeaderValues) Accept

func (*AttrAppendHeaderValues) Append

func (my *AttrAppendHeaderValues) Append(headers map[string][]any) *AttrAppendHeaderValues

func (*AttrAppendHeaderValues) AppendOne

func (my *AttrAppendHeaderValues) AppendOne(key string, values ...any) *AttrAppendHeaderValues

func (*AttrAppendHeaderValues) Authorization

func (my *AttrAppendHeaderValues) Authorization(username, password, title string) *AttrAppendHeaderValues

func (*AttrAppendHeaderValues) ContentType

func (my *AttrAppendHeaderValues) ContentType(contentType ContentType) *AttrAppendHeaderValues

func (*AttrAppendHeaderValues) Error

func (my *AttrAppendHeaderValues) Error() error

func (*AttrAppendHeaderValues) ImplHTTPClientAttributer

func (*AttrAppendHeaderValues) ImplHTTPClientAttributer()

func (*AttrAppendHeaderValues) Register

func (my *AttrAppendHeaderValues) Register(req *HTTPClient)

type AttrAutoCopyResBody

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

func AutoCopy

func AutoCopy(autoCopy bool) *AttrAutoCopyResBody

func (*AttrAutoCopyResBody) Error

func (*AttrAutoCopyResBody) Error() error

func (*AttrAutoCopyResBody) ImplHTTPClientAttributer

func (*AttrAutoCopyResBody) ImplHTTPClientAttributer()

func (*AttrAutoCopyResBody) Register

func (my *AttrAutoCopyResBody) Register(req *HTTPClient)

type AttrBody

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

func Bytes

func Bytes(body []byte) *AttrBody

func CSS

func CSS(body string) *AttrBody

func File

func File(filename string) *AttrBody

func Form

func Form(body map[string]any) *AttrBody

func FormData

func FormData(fields, files map[string]string) *AttrBody

func HTML

func HTML(body string) *AttrBody

func JSON

func JSON(body any) *AttrBody

func Javascript

func Javascript(body string) *AttrBody

func Plain

func Plain(body string) *AttrBody

func Reader

func Reader(body io.ReadCloser) *AttrBody

func (*AttrBody) Error

func (my *AttrBody) Error() error

func (*AttrBody) ImplHTTPClientAttributer

func (*AttrBody) ImplHTTPClientAttributer()

func (*AttrBody) Register

func (my *AttrBody) Register(req *HTTPClient)

type AttrCert

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

func Cert

func Cert(cert []byte) *AttrCert

func (*AttrCert) Error

func (my *AttrCert) Error() error

func (*AttrCert) ImplHTTPClientAttributer

func (*AttrCert) ImplHTTPClientAttributer()

func (*AttrCert) Register

func (my *AttrCert) Register(req *HTTPClient)

type AttrMethod

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

func Method

func Method(method string) *AttrMethod

func (*AttrMethod) Error

func (my *AttrMethod) Error() error

func (*AttrMethod) ImplHTTPClientAttributer

func (*AttrMethod) ImplHTTPClientAttributer()

func (*AttrMethod) Register

func (my *AttrMethod) Register(req *HTTPClient)

type AttrQueries

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

func Queries

func Queries(queries map[string]any) *AttrQueries

func (*AttrQueries) Append

func (my *AttrQueries) Append(queries map[string]any) *AttrQueries

func (*AttrQueries) AppendOne

func (my *AttrQueries) AppendOne(key string, value any) *AttrQueries

func (*AttrQueries) Error

func (my *AttrQueries) Error() error

func (*AttrQueries) ImplHTTPClientAttributer

func (*AttrQueries) ImplHTTPClientAttributer()

func (*AttrQueries) Register

func (my *AttrQueries) Register(req *HTTPClient)

func (*AttrQueries) RemoveEmpty added in v1.54.9

func (my *AttrQueries) RemoveEmpty() *AttrQueries

type AttrSetHeaderValue

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

func SetHeaderValue

func SetHeaderValue(headers map[string]any) *AttrSetHeaderValue

func (*AttrSetHeaderValue) Accept

func (my *AttrSetHeaderValue) Accept(accept Accept) *AttrSetHeaderValue

func (*AttrSetHeaderValue) Authorization

func (my *AttrSetHeaderValue) Authorization(username, password, title string) *AttrSetHeaderValue

func (*AttrSetHeaderValue) ContentType

func (my *AttrSetHeaderValue) ContentType(contentType ContentType) *AttrSetHeaderValue

func (*AttrSetHeaderValue) Error

func (my *AttrSetHeaderValue) Error() error

func (*AttrSetHeaderValue) ImplHTTPClientAttributer

func (*AttrSetHeaderValue) ImplHTTPClientAttributer()

func (*AttrSetHeaderValue) Register

func (my *AttrSetHeaderValue) Register(req *HTTPClient)

type AttrSetHeaderValues

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

func SetHeaderValues

func SetHeaderValues(headers map[string][]any) *AttrSetHeaderValues

func (*AttrSetHeaderValues) Accept

func (my *AttrSetHeaderValues) Accept(accept Accept) *AttrSetHeaderValues

func (*AttrSetHeaderValues) Authorization

func (my *AttrSetHeaderValues) Authorization(username, password, title string) *AttrSetHeaderValues

func (*AttrSetHeaderValues) ContentType

func (my *AttrSetHeaderValues) ContentType(contentType ContentType) *AttrSetHeaderValues

func (*AttrSetHeaderValues) Error

func (my *AttrSetHeaderValues) Error() error

func (*AttrSetHeaderValues) ImplHTTPClientAttributer

func (*AttrSetHeaderValues) ImplHTTPClientAttributer()

func (*AttrSetHeaderValues) Register

func (my *AttrSetHeaderValues) Register(req *HTTPClient)

type AttrTimeout

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

func Timeout

func Timeout(timeout time.Duration) *AttrTimeout

func (*AttrTimeout) Error

func (*AttrTimeout) Error() error

func (*AttrTimeout) ImplHTTPClientAttributer

func (*AttrTimeout) ImplHTTPClientAttributer()

func (*AttrTimeout) Register

func (my *AttrTimeout) Register(req *HTTPClient)

type AttrTransport

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

func Transport

func Transport(transport *http.Transport) *AttrTransport

func TransportDefault

func TransportDefault() *AttrTransport

func (*AttrTransport) Error

func (my *AttrTransport) Error() error

func (*AttrTransport) ImplHTTPClientAttributer

func (*AttrTransport) ImplHTTPClientAttributer()

func (*AttrTransport) Register

func (my *AttrTransport) Register(req *HTTPClient)

type AttrTransportDefault

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

type AttrURL

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

func (*AttrURL) Error

func (my *AttrURL) Error() error

func (*AttrURL) ImplHTTPClientAttributer

func (*AttrURL) ImplHTTPClientAttributer()

func (*AttrURL) Register

func (my *AttrURL) Register(req *HTTPClient)

type ContentType

type ContentType string

type HTTPClient

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

func (*HTTPClient) DELETE

func (*HTTPClient) DELETE(attrs ...HTTPClientAttributer) *HTTPClient

func (*HTTPClient) Error

func (my *HTTPClient) Error() error

func (*HTTPClient) GET

func (*HTTPClient) GET(attrs ...HTTPClientAttributer) *HTTPClient

func (*HTTPClient) GetBody

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

func (*HTTPClient) GetCert

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

func (*HTTPClient) GetClient

func (my *HTTPClient) GetClient() *http.Client

func (*HTTPClient) GetHeaders

func (my *HTTPClient) GetHeaders() map[string][]any

func (*HTTPClient) GetMethod

func (my *HTTPClient) GetMethod() string

func (*HTTPClient) GetQueries

func (my *HTTPClient) GetQueries() map[string]any

func (*HTTPClient) GetRawRequest

func (my *HTTPClient) GetRawRequest() *http.Request

func (*HTTPClient) GetRawResponse

func (my *HTTPClient) GetRawResponse() *http.Response

func (*HTTPClient) GetStatus added in v1.51.21

func (my *HTTPClient) GetStatus() string

func (*HTTPClient) GetStatusCode added in v1.51.21

func (my *HTTPClient) GetStatusCode() int

func (*HTTPClient) GetTimeout

func (my *HTTPClient) GetTimeout() time.Duration

func (*HTTPClient) GetTransport

func (my *HTTPClient) GetTransport() *http.Transport

func (*HTTPClient) GetURL

func (my *HTTPClient) GetURL() string

func (*HTTPClient) HEAD

func (*HTTPClient) HEAD(attrs ...HTTPClientAttributer) *HTTPClient

func (*HTTPClient) New

func (*HTTPClient) New(attrs ...HTTPClientAttributer) *HTTPClient

func (*HTTPClient) OPTIONS

func (*HTTPClient) OPTIONS(attrs ...HTTPClientAttributer) *HTTPClient

func (*HTTPClient) PATCH

func (*HTTPClient) PATCH(attrs ...HTTPClientAttributer) *HTTPClient

func (*HTTPClient) POST

func (*HTTPClient) POST(attrs ...HTTPClientAttributer) *HTTPClient

func (*HTTPClient) PUT

func (*HTTPClient) PUT(attrs ...HTTPClientAttributer) *HTTPClient

func (*HTTPClient) Send

func (my *HTTPClient) Send() *HTTPClient

func (*HTTPClient) SendWithRetry

func (my *HTTPClient) SendWithRetry(count uint, interval time.Duration, condition func(statusCode int, err error) bool) *HTTPClient

func (*HTTPClient) SetAttrs

func (my *HTTPClient) SetAttrs(attrs ...HTTPClientAttributer) *HTTPClient

func (*HTTPClient) TRACE

func (*HTTPClient) TRACE(attrs ...HTTPClientAttributer) *HTTPClient

func (*HTTPClient) ToBytes

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

func (*HTTPClient) ToJSON

func (my *HTTPClient) ToJSON(target any, keys ...any) *HTTPClient

func (*HTTPClient) ToWriter

func (my *HTTPClient) ToWriter(writer http.ResponseWriter) *HTTPClient

func (*HTTPClient) ToXML

func (my *HTTPClient) ToXML(target any) *HTTPClient

type HTTPClientAttributer

type HTTPClientAttributer interface {
	Register(req *HTTPClient)
	Error() error
	ImplHTTPClientAttributer()
}

func URL

func URL(urls ...any) HTTPClientAttributer

func XML

func XML(body any) HTTPClientAttributer

type HTTPClientBuilder

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

func (*HTTPClientBuilder) GetClient

func (my *HTTPClientBuilder) GetClient() *HTTPClient

func (*HTTPClientBuilder) New

Jump to

Keyboard shortcuts

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