httpClientV2

package
v1.35.18 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	APP                  Launch
	HttpClientApp        HttpClient
	HttpClientBuilderApp HttpClientBuilder
)
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:        "*/*",
	}
)

Functions

This section is empty.

Types

type Accept

type Accept string

type AttrAutoCopyResBody added in v1.35.9

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

func AutoCopy added in v1.24.7

func AutoCopy(autoCopy bool) *AttrAutoCopyResBody

func (*AttrAutoCopyResBody) Error added in v1.35.9

func (*AttrAutoCopyResBody) Error() error

func (*AttrAutoCopyResBody) Register added in v1.35.9

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

type AttrBody added in v1.35.9

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

func Bytes added in v1.25.11

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 Javascript

func Javascript(body string) *AttrBody

func Json

func Json(body any) *AttrBody

func Plain

func Plain(body string) *AttrBody

func Reader

func Reader(body io.ReadCloser) *AttrBody

func (*AttrBody) Error added in v1.35.9

func (my *AttrBody) Error() error

func (*AttrBody) Register added in v1.35.9

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

type AttrCert added in v1.35.9

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

func Cert added in v1.24.7

func Cert(cert []byte) *AttrCert

func (*AttrCert) Error added in v1.35.9

func (my *AttrCert) Error() error

func (*AttrCert) Register added in v1.35.9

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

type AttrHeaders added in v1.35.9

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

func Headers added in v1.24.7

func Headers(headers map[string][]string) *AttrHeaders

func (*AttrHeaders) Accept added in v1.35.9

func (my *AttrHeaders) Accept(accept Accept) *AttrHeaders

func (*AttrHeaders) Append added in v1.35.9

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

func (*AttrHeaders) AppendOne added in v1.35.9

func (my *AttrHeaders) AppendOne(key string, values ...string) *AttrHeaders

func (*AttrHeaders) Authorization added in v1.35.9

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

func (*AttrHeaders) ContentType added in v1.35.9

func (my *AttrHeaders) ContentType(contentType ContentType) *AttrHeaders

func (*AttrHeaders) Error added in v1.35.9

func (my *AttrHeaders) Error() error

func (*AttrHeaders) Register added in v1.35.9

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

type AttrMethod added in v1.35.9

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

func Method added in v1.24.7

func Method(method string) *AttrMethod

func (*AttrMethod) Error added in v1.35.9

func (my *AttrMethod) Error() error

func (*AttrMethod) Register added in v1.35.9

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

type AttrQueries added in v1.35.9

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

func Queries added in v1.24.7

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

func (*AttrQueries) Append added in v1.35.9

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

func (*AttrQueries) AppendOne added in v1.35.9

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

func (*AttrQueries) Error added in v1.35.9

func (my *AttrQueries) Error() error

func (*AttrQueries) Register added in v1.35.9

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

type AttrSetHeaders added in v1.35.9

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

func SetHeaders

func SetHeaders(headers map[string][]string) *AttrSetHeaders

func (*AttrSetHeaders) Accept added in v1.35.9

func (my *AttrSetHeaders) Accept(accept Accept) *AttrSetHeaders

func (*AttrSetHeaders) Authorization added in v1.35.9

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

func (*AttrSetHeaders) ContentType added in v1.35.9

func (my *AttrSetHeaders) ContentType(contentType ContentType) *AttrSetHeaders

func (*AttrSetHeaders) Error added in v1.35.9

func (my *AttrSetHeaders) Error() error

func (*AttrSetHeaders) Register added in v1.35.9

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

type AttrTimeout added in v1.35.9

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

func Timeout added in v1.24.8

func Timeout(timeout time.Duration) *AttrTimeout

func (*AttrTimeout) Error added in v1.35.9

func (*AttrTimeout) Error() error

func (*AttrTimeout) Register added in v1.35.9

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

type AttrTransport added in v1.35.9

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

func Transport added in v1.24.7

func Transport(transport *http.Transport) *AttrTransport

func (*AttrTransport) Error added in v1.35.9

func (my *AttrTransport) Error() error

func (*AttrTransport) Register added in v1.35.9

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

type AttrUrl added in v1.35.9

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

func (*AttrUrl) Error added in v1.35.9

func (my *AttrUrl) Error() error

func (*AttrUrl) Register added in v1.35.9

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

type ContentType

type ContentType string

type HttpClient

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

func (*HttpClient) Error

func (my *HttpClient) Error() error

func (*HttpClient) GetBody added in v1.24.7

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

func (*HttpClient) GetCert added in v1.24.7

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

func (*HttpClient) GetClient added in v1.24.7

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

func (*HttpClient) GetHeaders added in v1.24.7

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

func (*HttpClient) GetMethod added in v1.24.7

func (my *HttpClient) GetMethod() string

func (*HttpClient) GetQueries added in v1.24.7

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

func (*HttpClient) GetRawRequest added in v1.24.7

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

func (*HttpClient) GetRawResponse added in v1.24.7

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

func (*HttpClient) GetTimeout added in v1.24.7

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

func (*HttpClient) GetTransport added in v1.24.7

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

func (*HttpClient) GetUrl added in v1.24.7

func (my *HttpClient) GetUrl() string

func (*HttpClient) New

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

func (*HttpClient) NewDelete added in v1.25.29

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

func (*HttpClient) NewGet added in v1.25.29

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

func (*HttpClient) NewHead added in v1.25.29

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

func (*HttpClient) NewOptions added in v1.25.29

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

func (*HttpClient) NewPatch added in v1.25.29

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

func (*HttpClient) NewPost added in v1.25.29

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

func (*HttpClient) NewPut added in v1.25.29

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

func (*HttpClient) NewTrace added in v1.25.29

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

func (*HttpClient) ParseBody added in v1.24.7

func (my *HttpClient) ParseBody()

func (*HttpClient) Send

func (my *HttpClient) Send() *HttpClient

func (*HttpClient) Set added in v1.24.7

func (my *HttpClient) Set(options ...HttpClientAttributer) *HttpClient

func (*HttpClient) ToBytes added in v1.25.12

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

func (*HttpClient) ToJson added in v1.24.7

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

func (*HttpClient) ToWriter added in v1.24.7

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

func (*HttpClient) ToXml added in v1.24.7

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

type HttpClientAttributer added in v1.29.16

type HttpClientAttributer interface {
	Register(req *HttpClient)
	Error() error
	// contains filtered or unexported methods
}

func Url added in v1.24.7

func Url(urls ...string) HttpClientAttributer

func Xml

func Xml(body any) HttpClientAttributer

type HttpClientBuilder added in v1.25.29

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

func (*HttpClientBuilder) GetClient added in v1.25.29

func (my *HttpClientBuilder) GetClient() *HttpClient

func (*HttpClientBuilder) New added in v1.25.29

type Launch added in v1.34.0

type Launch struct {
	HttpClient        HttpClient
	HttpClientBuilder HttpClientBuilder
}

Jump to

Keyboard shortcuts

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