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) SetTLSConfig(tlsCfg *tls.Config) (client *Client)
- func (c *Client) SetTimeout(timeout time.Duration) (client *Client)
- func (c *Client) SetTransport(transport *http.Transport) (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) EndBytesForAlipayV3(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)
- type RequestIdHandler
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 ¶ added in v1.5.101
func FormatURLParam ¶ added in v1.5.47
Types ¶
type Client ¶
func NewClient ¶
func NewClient() (client *Client)
NewClient , default tls.Config{InsecureSkipVerify: true}
func (*Client) Req ¶ added in v1.5.97
typeStr is request type and response type default is TypeJSON first param is request type second param is response data type
func (*Client) SetBodySize ¶ added in v1.5.82
set body size (MB), default is 10MB
type Request ¶ added in v1.5.97
func (*Request) EndBytesForAlipayV3 ¶ added in v1.5.106
func (*Request) SendBodyMap ¶ added in v1.5.97
func (*Request) SendMultipartBodyMap ¶ added in v1.5.97
func (*Request) SendString ¶ added in v1.5.97
encodeStr: url.Values.Encode() or jsonBody
func (*Request) SendStruct ¶ added in v1.5.97
type RequestIdHandler ¶ added in v1.5.106
type RequestIdHandler interface {
RequestId() string
}
Click to show internal directories.
Click to hide internal directories.