Documentation ¶
Index ¶
Constants ¶
View Source
const ( Authorization = "Authorization" ContentType = "Content-Type" Accept = "Accept" Basic = "Basic" Bearer = "Bearer" )
Constant Header
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallX ¶
type CallX interface { Get(url string) Response Post(url string, body interface{}) Response Patch(url string, body interface{}) Response Put(url string, body interface{}) Response Delete(url string) Response Req(custom Custom) Response AddInterceptor(intercept ...Interceptor) // contains filtered or unexported methods }
CallX the interface
type Config ¶
type Config struct { BaseURL string // Client name. Used in User-Agent request header. // // Default client name is used if not set. Name string // Maximum duration for full request writing and response reading (including body). // Timeout time.Duration // Maximum duration for full response reading (including body). // // By default response read timeout is unlimited. ReadTimeout time.Duration // Maximum duration for full request writing (including body). // // By default request write timeout is unlimited. WriteTimeout time.Duration // Idle keep-alive connections are closed after this duration. // // By default idle connections are closed after DefaultMaxIdleConnDuration. MaxIdleConnDuration time.Duration Interceptor []Interceptor // TLS config for https connections. // // Default TLS config is used if not set. TLSConfig *tls.Config // InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name. InsecureSkipVerify bool // TCPDialer contains options to control a group of Dial calls. TCPDialer *fasthttp.TCPDialer // Maximum number of connections per each host which may be established. // // DefaultMaxConnsPerHost is used if not set. MaxConnsPerHost int // Per-connection buffer size for responses' reading. // This also limits the maximum header size. // // Default buffer size is used if 0. ReadBufferSize int // Per-connection buffer size for requests' writing. // // Default buffer size is used if 0. WriteBufferSize int // RetryIf controls whether a retry should be attempted after an error. // // By default will use isIdempotent function. RetryIf fasthttp.RetryIfFunc // StreamResponseBody enables response body streaming. StreamResponseBody bool Cookies bool }
Config callx model
type Interceptor ¶
Interceptor the interface
func HeaderInterceptor ¶
func HeaderInterceptor(header Header) Interceptor
HeaderInterceptor provide a instance
func JSONContentTypeInterceptor ¶
func JSONContentTypeInterceptor() Interceptor
JSONContentTypeInterceptor provide a instance
Click to show internal directories.
Click to hide internal directories.