http

package
v0.0.0-...-6d34543 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ...Options) *Client

func (*Client) CloseIdleConnections

func (c *Client) CloseIdleConnections(ctx context.Context)

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, addr string, req *resty.Request) (resp *resty.Response, err error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, addr string) (resp *http.Response, err error)

---------------------------------------------------------------------------------------------- // ----------------------------------------- 兼容旧方法 ------------------------------------------ // --------------------------------------- 以下方法不建议使用 -------------------------------------- // --------------------------------------------------------------------------------------------- //

func (*Client) Post

func (c *Client) Post(ctx context.Context, addr, contentType string, body io.Reader) (resp *http.Response, err error)

func (*Client) PostForm

func (c *Client) PostForm(ctx context.Context, addr string, data url.Values) (resp *http.Response, err error)

func (*Client) RC

func (c *Client) RC() *resty.Client

func (*Client) RequestGet

func (c *Client) RequestGet(ctx context.Context, addr string, header map[string]string) (*resty.Response, error)

func (*Client) RequestPost

func (c *Client) RequestPost(ctx context.Context, addr string, data interface{}, header map[string]string) (*resty.Response, error)

func (*Client) RequestPostJson

func (c *Client) RequestPostJson(ctx context.Context, addr string, data interface{}) (*resty.Response, error)

func (*Client) SendGet

func (c *Client) SendGet(ctx context.Context, addr string) (rtyResp *resty.Response, err error)

func (*Client) SendPost

func (c *Client) SendPost(ctx context.Context, addr, contentType string, body io.Reader) (rtyResp *resty.Response, err error)

func (*Client) SetTimeout

func (c *Client) SetTimeout(ttl time.Duration) *Client

func (*Client) SetTransport

func (c *Client) SetTransport(transport http.RoundTripper) *Client

type Options

type Options func(*Client)

func WithProxy

func WithProxy(proxy ...func() interface{}) Options

func WithTimeOut

func WithTimeOut(timeout time.Duration) Options

Jump to

Keyboard shortcuts

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