toolkit_http

package
v0.0.0-...-1bda70e Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultReadTimeout  = 10 * time.Second
	DefaultWriteTimeout = 10 * time.Second
	MaxConnTimeout      = 60 * time.Second
	MaxConnsPerHost     = 2000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpClient

type HttpClient struct {
	*fasthttp.Client
	//config *HttpClientConfig
	Cookie  []*fasthttp.Cookie
	Headers map[string]string
}

func NewFastClient

func NewFastClient(client *fasthttp.Client) *HttpClient

func (*HttpClient) CleanCookie

func (c *HttpClient) CleanCookie()

func (*HttpClient) Get

func (c *HttpClient) Get(urlString string, param map[string]string) ([]byte, error)

func (*HttpClient) GetCookie

func (c *HttpClient) GetCookie() []*fasthttp.Cookie

func (*HttpClient) Post

func (c *HttpClient) Post(url string, param map[string]interface{}) ([]byte, error)

func (*HttpClient) SetClientReadTimeout

func (c *HttpClient) SetClientReadTimeout(duration time.Duration)

func (*HttpClient) SetClientWriteTimeout

func (c *HttpClient) SetClientWriteTimeout(duration time.Duration)

func (*HttpClient) SetCookie

func (c *HttpClient) SetCookie(cookieValue map[string]string)

func (*HttpClient) SetRequestHeaders

func (c *HttpClient) SetRequestHeaders(headers map[string]string)

func (*HttpClient) SetSkipVerifyTLSConfig

func (c *HttpClient) SetSkipVerifyTLSConfig(isSkip bool)

type HttpClientConfig

type HttpClientConfig struct {
	Name                          *string
	NoDefaultUserAgentHeader      *bool
	Dial                          *fasthttp.DialFunc
	DialDualStack                 *bool
	TLSConfig                     *tls.Config
	MaxConnsPerHost               *int
	MaxIdleConnDuration           *time.Duration
	MaxConnDuration               *time.Duration
	MaxIdemponentCallAttempts     *int
	ReadBufferSize                *int
	WriteBufferSize               *int
	ReadTimeout                   *time.Duration
	WriteTimeout                  *time.Duration
	MaxResponseBodySize           *int
	DisableHeaderNamesNormalizing *bool
	DisablePathNormalizing        *bool
	MaxConnWaitTimeout            *time.Duration
	RetryIf                       *fasthttp.RetryIfFunc
	ConfigureClient               *func(hc *fasthttp.HostClient) error
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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