xhttp

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

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

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

func Sign

func Sign(params map[string]interface{}, secretKey string) (sign string)

func VerifySign

func VerifySign(params map[string]interface{}, secretKey string, sign string) bool

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

func (*Client) SendStruct

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

func (*Client) SetHost

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

func (*Client) SetMethod

func (c *Client) SetMethod(method 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) SetUrl

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

func (*Client) Type

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

type File

type File struct {
	Name    string `json:"name"`
	Content []byte `json:"content"`
}

type RequestType

type RequestType string

Jump to

Keyboard shortcuts

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