Documentation ¶
Index ¶
- Constants
- func ConvertToString(v any) (str string)
- func FormatURLParam(body map[string]any) (urlParam string)
- type Client
- func (c *Client) Req(typeStr ...string) *Request
- func (c *Client) SetBodySize(sizeMB int) (client *Client)
- func (c *Client) SetHttpTLSConfig(tlsCfg *tls.Config) (client *Client)
- func (c *Client) SetHttpTransport(transport *http.Transport) (client *Client)
- func (c *Client) SetTimeout(timeout time.Duration) (client *Client)
- func (c *Client) SetTransport(transport http.RoundTripper) (client *Client)
- type Request
- func (r *Request) Delete(url string) *Request
- func (r *Request) EndBytes(ctx context.Context) (res *http.Response, bs []byte, err error)
- func (r *Request) EndStruct(ctx context.Context, v any) (res *http.Response, err error)
- func (r *Request) Get(url string) *Request
- func (r *Request) Patch(url string) *Request
- func (r *Request) Post(url string) *Request
- func (r *Request) Put(url string) *Request
- func (r *Request) SendBodyMap(bm map[string]any) (client *Request)
- func (r *Request) SendMultipartBodyMap(bm map[string]any) (client *Request)
- func (r *Request) SendString(encodeStr string) (client *Request)
- func (r *Request) SendStruct(v any) (c *Request)
Constants ¶
View Source
const ( GET = "GET" POST = "POST" PUT = "PUT" DELETE = "DELETE" PATCH = "PATCH" ResTypeJSON = "json" ResTypeXML = "xml" TypeJSON = "json" TypeXML = "xml" TypeFormData = "form-data" TypeMultipartFormData = "multipart-form-data" )
Variables ¶
This section is empty.
Functions ¶
func ConvertToString ¶
func FormatURLParam ¶
Types ¶
type Client ¶
func NewClient ¶
func NewClient() (client *Client)
NewClient , default tls.Config{InsecureSkipVerify: true}
func (*Client) Req ¶
typeStr is request type and response type default is TypeJSON first param is request type second param is response data type
func (*Client) SetBodySize ¶
set body size (MB), default is 10MB
func (*Client) SetHttpTLSConfig ¶ added in v0.0.3
func (*Client) SetHttpTransport ¶ added in v0.0.3
func (*Client) SetTransport ¶
func (c *Client) SetTransport(transport http.RoundTripper) (client *Client)
type Request ¶
func (*Request) SendMultipartBodyMap ¶
func (*Request) SendString ¶
encodeStr: url.Values.Encode() or jsonBody
func (*Request) SendStruct ¶
Click to show internal directories.
Click to hide internal directories.