v1.5.93 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 17 Imported by: 0




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"


This section is empty.


func FormatURLParam

func FormatURLParam(body map[string]interface{}) (urlParam string)


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) Delete

func (c *Client) Delete(url string) (client *Client)

func (*Client) EndBytes

func (c *Client) EndBytes(ctx context.Context) (res *http.Response, bs []byte, err error)

func (*Client) EndStruct

func (c *Client) EndStruct(ctx context.Context, v interface{}) (res *http.Response, err error)

func (*Client) Get

func (c *Client) Get(url string) (client *Client)

func (*Client) Patch

func (c *Client) Patch(url string) (client *Client)

func (*Client) Post

func (c *Client) Post(url string) (client *Client)

func (*Client) Put

func (c *Client) Put(url string) (client *Client)

func (*Client) SendBodyMap

func (c *Client) SendBodyMap(bm map[string]interface{}) (client *Client)

func (*Client) SendMultipartBodyMap

func (c *Client) SendMultipartBodyMap(bm map[string]interface{}) (client *Client)

func (*Client) SendString

func (c *Client) SendString(encodeStr string) (client *Client)

encodeStr: url.Values.Encode() or jsonBody

func (*Client) SendStruct

func (c *Client) SendStruct(v interface{}) (client *Client)

func (*Client) SetBodySize

func (c *Client) SetBodySize(sizeMB int) (client *Client)

set body size (MB), default is 10MB

func (*Client) SetHost

func (c *Client) SetHost(host string) (client *Client)

func (*Client) SetTLSConfig

func (c *Client) SetTLSConfig(tlsCfg *tls.Config) (client *Client)

func (*Client) SetTimeout

func (c *Client) SetTimeout(timeout time.Duration) (client *Client)

func (*Client) SetTransport

func (c *Client) SetTransport(transport *http.Transport) (client *Client)

func (*Client) Type

func (c *Client) Type(typeStr RequestType) (client *Client)

type RequestType

type RequestType string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL