httpClientV2

package
v1.47.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 20 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]string) *AttrAppendHeaderValue

func (*AttrAppendHeaderValue) Accept

func (*AttrAppendHeaderValue) Append

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

func (*AttrAppendHeaderValue) AppendOne

func (my *AttrAppendHeaderValue) AppendOne(key string, value string) *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 added in v1.45.13

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][]string) *AttrAppendHeaderValues

func (*AttrAppendHeaderValues) Accept

func (*AttrAppendHeaderValues) Append

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

func (*AttrAppendHeaderValues) AppendOne

func (my *AttrAppendHeaderValues) AppendOne(key string, values ...string) *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 added in v1.45.13

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 added in v1.45.13

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 added in v1.45.13

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 added in v1.45.13

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 added in v1.45.13

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 added in v1.45.13

func (*AttrQueries) ImplHttpClientAttributer()

func (*AttrQueries) Register

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

type AttrSetHeaderValue

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

func SetHeaderValue

func SetHeaderValue(headers map[string]string) *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 added in v1.45.13

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][]string) *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 added in v1.45.13

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 added in v1.45.13

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 (*AttrTransport) Error

func (my *AttrTransport) Error() error

func (*AttrTransport) ImplHttpClientAttributer added in v1.45.13

func (*AttrTransport) ImplHttpClientAttributer()

func (*AttrTransport) Register

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

type AttrTransportDefault

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

func TransportDefault

func TransportDefault() *AttrTransportDefault

func (*AttrTransportDefault) Error

func (my *AttrTransportDefault) Error() error

func (*AttrTransportDefault) ImplHttpClientAttributer added in v1.45.13

func (*AttrTransportDefault) ImplHttpClientAttributer()

func (*AttrTransportDefault) Register

func (my *AttrTransportDefault) Register(req *HttpClient)

type AttrURL

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

func (*AttrURL) Error

func (my *AttrURL) Error() error

func (*AttrURL) ImplHttpClientAttributer added in v1.45.13

func (*AttrURL) ImplHttpClientAttributer()

func (*AttrURL) Register

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

type ContentType

type ContentType string

type HttpClient added in v1.45.13

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

func (*HttpClient) Error added in v1.45.13

func (my *HttpClient) Error() error

func (*HttpClient) GetBody added in v1.45.13

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

func (*HttpClient) GetCert added in v1.45.13

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

func (*HttpClient) GetClient added in v1.45.13

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

func (*HttpClient) GetHeaders added in v1.45.13

func (my *HttpClient) GetHeaders() map[string][]string

func (*HttpClient) GetMethod added in v1.45.13

func (my *HttpClient) GetMethod() string

func (*HttpClient) GetQueries added in v1.45.13

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

func (*HttpClient) GetRawRequest added in v1.45.13

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

func (*HttpClient) GetRawResponse added in v1.45.13

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

func (*HttpClient) GetTimeout added in v1.45.13

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

func (*HttpClient) GetTransport added in v1.45.13

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

func (*HttpClient) GetURL added in v1.45.13

func (my *HttpClient) GetURL() string

func (*HttpClient) New added in v1.45.13

func (*HttpClient) New(attrs ...HttpClientAttributer) *HttpClient

func (*HttpClient) NewDelete added in v1.45.13

func (*HttpClient) NewDelete(attrs ...HttpClientAttributer) *HttpClient

func (*HttpClient) NewGet added in v1.45.13

func (*HttpClient) NewGet(attrs ...HttpClientAttributer) *HttpClient

func (*HttpClient) NewHead added in v1.45.13

func (*HttpClient) NewHead(attrs ...HttpClientAttributer) *HttpClient

func (*HttpClient) NewOptions added in v1.45.13

func (*HttpClient) NewOptions(attrs ...HttpClientAttributer) *HttpClient

func (*HttpClient) NewPatch added in v1.45.13

func (*HttpClient) NewPatch(attrs ...HttpClientAttributer) *HttpClient

func (*HttpClient) NewPost added in v1.45.13

func (*HttpClient) NewPost(attrs ...HttpClientAttributer) *HttpClient

func (*HttpClient) NewPut added in v1.45.13

func (*HttpClient) NewPut(attrs ...HttpClientAttributer) *HttpClient

func (*HttpClient) NewTrace added in v1.45.13

func (*HttpClient) NewTrace(attrs ...HttpClientAttributer) *HttpClient

func (*HttpClient) Send added in v1.45.13

func (my *HttpClient) Send() *HttpClient

func (*HttpClient) SetAttrs added in v1.45.13

func (my *HttpClient) SetAttrs(attrs ...HttpClientAttributer) *HttpClient

func (*HttpClient) ToBytes added in v1.45.13

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

func (*HttpClient) ToJson added in v1.45.13

func (my *HttpClient) ToJson(target any, keys ...any) *HttpClient

func (*HttpClient) ToWriter added in v1.45.13

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

func (*HttpClient) ToXml added in v1.45.13

func (my *HttpClient) ToXml(target any) *HttpClient

type HttpClientAttributer added in v1.45.13

type HttpClientAttributer interface {
	Register(req *HttpClient)
	Error() error
	ImplHttpClientAttributer()
}

func URL

func URL(urls ...string) HttpClientAttributer

func XML

func XML(body any) HttpClientAttributer

type HttpClientBuilder added in v1.45.13

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

func (*HttpClientBuilder) GetClient added in v1.45.13

func (my *HttpClientBuilder) GetClient() *HttpClient

func (*HttpClientBuilder) New added in v1.45.13

Jump to

Keyboard shortcuts

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