http

package
v0.0.0-...-2cf5803 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 11 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
}

Client is http client.

func NewClient

func NewClient(c *ClientConfig) *Client

NewClient new a http client.

func (*Client) Do

func (client *Client) Do(c context.Context, req *xhttp.Request, res interface{}, v ...string) (err error)

Do sends an HTTP request and returns an HTTP json response.

func (*Client) Get

func (client *Client) Get(c context.Context, uri, ip string, params url.Values, res interface{}) (err error)

Get issues a GET to the specified URL.

func (*Client) NewRequest

func (client *Client) NewRequest(method, uri, realIP string, params url.Values) (req *xhttp.Request, err error)

NewRequest new http request with method, uri, ip, values and headers.

func (*Client) Post

func (client *Client) Post(c context.Context, uri, ip string, params url.Values, res interface{}) (err error)

Post issues a Post to the specified URL.

func (*Client) Raw

func (client *Client) Raw(c context.Context, req *xhttp.Request, v ...string) (bs []byte, err error)

Raw sends an HTTP request and returns bytes response

func (*Client) SetTransport

func (client *Client) SetTransport(t xhttp.RoundTripper)

SetTransport set client transport

type ClientConfig

type ClientConfig struct {
	Dial      time.Duration
	KeepAlive time.Duration
}

ClientConfig is http client conf.

Jump to

Keyboard shortcuts

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