Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) Curl(path string, method MethodType, data interface{}, cType ContentType) ([]byte, error)
- func (c *Client) Delete(path string, data interface{}) ([]byte, error)
- func (c *Client) Get(path string, data interface{}) ([]byte, error)
- func (c *Client) Patch(path string, data interface{}) ([]byte, error)
- func (c *Client) PatchByForm(path string, data interface{}) ([]byte, error)
- func (c *Client) Post(path string, data interface{}) ([]byte, error)
- func (c *Client) PostByForm(path string, data interface{}) ([]byte, error)
- func (c *Client) Put(path string, data interface{}) ([]byte, error)
- func (c *Client) PutByForm(path string, data interface{}) ([]byte, error)
- func (c *Client) SetBody(body string) *Client
- func (c *Client) SetCookies(cookies []*http.Cookie) *Client
- func (c *Client) SetHeaders(headers map[string]string) *Client
- func (c *Client) SetTimeout(timeout time.Duration) *Client
- type ContentType
- type MethodType
Constants ¶
View Source
const ( // method Get MethodType = "GET" Post MethodType = "POST" Put MethodType = "PUT" Patch MethodType = "PATCH" Delete MethodType = "DELETE" // content_type JsonType ContentType = "application/json" FormType ContentType = "application/x-www-form-urlencoded" OtherType ContentType = "null" // need set header and body )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client struct
func (*Client) Curl ¶
func (c *Client) Curl(path string, method MethodType, data interface{}, cType ContentType) ([]byte, error)
Curl url request
func (*Client) PatchByForm ¶
PatchByForm request patch, content_type for "application/x-www-form-urlencoded"
func (*Client) PostByForm ¶
PostByForm request post, content_type for "application/x-www-form-urlencoded"
func (*Client) PutByForm ¶
PutByForm request put, content_type for "application/x-www-form-urlencoded"
func (*Client) SetCookies ¶
SetCookies set request cookies
func (*Client) SetHeaders ¶
SetHeaders set request headers
type ContentType ¶
type ContentType string
Click to show internal directories.
Click to hide internal directories.