Documentation ¶
Index ¶
- Variables
- func GetQueryString(params map[string]interface{}) []byte
- func IsNil(v interface{}) bool
- func IsValueArray(v reflect.Value) bool
- func IsValueNil(v reflect.Value) bool
- func IsValuePtr(v reflect.Value) bool
- func IsValueSlice(v reflect.Value) bool
- func Log(uri string, payload []byte, res *Response, err error)
- type Args
- type BasicAuth
- type Body
- type Client
- func (c *Client) DELETE(url string, config ...*Config) (r *Req)
- func (c *Client) GET(url string, config ...*Config) (req *Req)
- func (c *Client) NewReq(url string, method string, config *Config) *Req
- func (c *Client) PATCH(url string, config *Config) (r *Req)
- func (c *Client) POST(url string, config *Config) (r *Req)
- func (c *Client) PUT(url string, config *Config) (r *Req)
- func (c *Client) SetBasicAuth(Username, Password string)
- func (c *Client) SetBasicUrl(url string)
- func (c *Client) SetHeaders(headers map[string]string)
- func (c *Client) SetTimeout(timeout time.Duration)
- type ClientConfig
- type Config
- type GlobalConfig
- type Req
- func (r *Req) AddForm(k string, v interface{}) *Req
- func (r *Req) AddForms(form map[string]interface{}) *Req
- func (r *Req) AddHeader(k, v string) *Req
- func (r *Req) AddHeaders(headers map[string]string) *Req
- func (r *Req) AddParam(k string, v interface{}) *Req
- func (r *Req) AddParams(params map[string]interface{}) *Req
- func (r *Req) Do() (res *Response, err error)
- func (r *Req) SetHeader(k, v string) *Req
- func (r *Req) SetHeaders(headers map[string]string) *Req
- type Reqs
- type Response
- type TimeoutError
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = &GlobalConfig{ IsLog: false, LogHandler: func(uri string, payload []byte, res Response, err error) { log.Println("status:", res.Status, "url:", uri, "payload:", string(payload), "resp:", res.String(), "err:", err) }, NotOkError: errors.New("request not success"), JSONEncoder: json.Marshal, JSONDecoder: json.Unmarshal, }
View Source
var ErrTimeout = &TimeoutError{}
ErrTimeout is returned from timed out calls.
Functions ¶
func GetQueryString ¶
func IsValueArray ¶ added in v1.2.7
func IsValueNil ¶ added in v1.2.7
func IsValuePtr ¶ added in v1.2.7
func IsValueSlice ¶ added in v1.2.7
Types ¶
type BasicAuth ¶
type BasicAuth struct {
Username, Password string
}
var client = &fasthttp.Client{}
type Client ¶
type Client struct { *fasthttp.Client ClientConfig *ClientConfig }
func NewClient ¶
func NewClient(configs ...*ClientConfig) *Client
func (*Client) SetBasicAuth ¶ added in v1.4.1
func (*Client) SetBasicUrl ¶ added in v1.4.1
func (*Client) SetHeaders ¶ added in v1.4.1
func (*Client) SetTimeout ¶ added in v1.4.1
type ClientConfig ¶ added in v1.4.1
type GlobalConfig ¶
type TimeoutError ¶ added in v1.4.3
type TimeoutError struct{}
func (*TimeoutError) Error ¶ added in v1.4.3
func (e *TimeoutError) Error() string
Click to show internal directories.
Click to hide internal directories.