Documentation ¶
Index ¶
- Constants
- func FormatURLParam(body map[string]any) (urlParam string)
- type Client
- func (c *Client) Delete(url string) (client *Client)
- func (c *Client) EndBytes(ctx context.Context) (res *http.Response, bs []byte, err error)
- func (c *Client) EndStruct(ctx context.Context, v any) (res *http.Response, err error)
- func (c *Client) Get(url string) (client *Client)
- func (c *Client) Patch(url string) (client *Client)
- func (c *Client) Post(url string) (client *Client)
- func (c *Client) Put(url string) (client *Client)
- func (c *Client) SendBodyMap(bm map[string]any) (client *Client)
- func (c *Client) SendMultipartBodyMap(bm map[string]any) (client *Client)
- func (c *Client) SendString(encodeStr string) (client *Client)
- func (c *Client) SendStruct(v any) (client *Client)
- func (c *Client) SetBodySize(sizeMB int) (client *Client)
- func (c *Client) SetHost(host string) (client *Client)
- func (c *Client) SetTLSConfig(tlsCfg *tls.Config) (client *Client)
- func (c *Client) SetTimeout(timeout time.Duration) (client *Client)
- func (c *Client) SetTransport(transport *http.Transport) (client *Client)
- func (c *Client) Type(typeStr RequestType) (client *Client)
- type RequestType
Constants ¶
View Source
const ( GET = "GET" POST = "POST" PUT = "PUT" DELETE = "DELETE" PATCH = "PATCH" TypeJSON RequestType = "json" TypeXML RequestType = "xml" TypeUrlencoded RequestType = "urlencoded" TypeForm RequestType = "form" TypeFormData RequestType = "form-data" TypeMultipartFormData RequestType = "multipart-form-data" )
Variables ¶
This section is empty.
Functions ¶
func FormatURLParam ¶
Types ¶
type Client ¶
type Client struct { HttpClient *http.Client Transport *http.Transport Header http.Header Timeout time.Duration Host string FormString string ContentType string // contains filtered or unexported fields }
func NewClient ¶
func NewClient() (client *Client)
NewClient , default tls.Config{InsecureSkipVerify: true}
func (*Client) SendMultipartBodyMap ¶
func (*Client) SendString ¶
encodeStr: url.Values.Encode() or jsonBody
func (*Client) SendStruct ¶
func (*Client) SetBodySize ¶
set body size (MB), default is 10MB
func (*Client) SetTransport ¶
func (*Client) Type ¶
func (c *Client) Type(typeStr RequestType) (client *Client)
type RequestType ¶
type RequestType string
Click to show internal directories.
Click to hide internal directories.