httpgo

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: GPL-3.0 Imports: 7 Imported by: 3

README

simple go http client

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(timeout time.Duration, transport http.RoundTripper) *Client

NewClient create a new httpgo client, if transport is nil, the client uses `http.DefaultTransport`.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, url string, headers ...Header) (*http.Response, error)

func (*Client) DeleteJSON

func (c *Client) DeleteJSON(ctx context.Context, url string, headers ...Header) (*http.Response, error)

func (*Client) DeleteJsonWithAuth

func (c *Client) DeleteJsonWithAuth(ctx context.Context, url string, token string, headers ...Header) (*http.Response, error)

func (*Client) DeleteWithAuth added in v1.2.0

func (c *Client) DeleteWithAuth(ctx context.Context, url string, token string, headers ...Header) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, url string, headers ...Header) (*http.Response, error)

func (*Client) GetJSON

func (c *Client) GetJSON(ctx context.Context, url string, headers ...Header) (*http.Response, error)

func (*Client) GetJsonWithAuth

func (c *Client) GetJsonWithAuth(ctx context.Context, url string, token string, headers ...Header) (*http.Response, error)

func (*Client) GetWithAuth added in v1.2.0

func (c *Client) GetWithAuth(ctx context.Context, url string, token string, headers ...Header) (*http.Response, error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, url string, body []byte, headers ...Header) (*http.Response, error)

func (*Client) PostJSON

func (c *Client) PostJSON(ctx context.Context, url string, data interface{}, headers ...Header) (*http.Response, error)

func (*Client) PostJsonWithAuth

func (c *Client) PostJsonWithAuth(ctx context.Context, url string, token string, data interface{}, headers ...Header) (*http.Response, error)

func (*Client) PostWithAuth added in v1.2.0

func (c *Client) PostWithAuth(ctx context.Context, url string, token string, body []byte, headers ...Header) (*http.Response, error)

func (*Client) Put

func (c *Client) Put(ctx context.Context, url string, body []byte, headers ...Header) (*http.Response, error)

func (*Client) PutJSON

func (c *Client) PutJSON(ctx context.Context, url string, data interface{}, headers ...Header) (*http.Response, error)

func (*Client) PutJsonWithAuth

func (c *Client) PutJsonWithAuth(ctx context.Context, url string, token string, data interface{}, headers ...Header) (*http.Response, error)

func (*Client) PutWithAuth added in v1.2.0

func (c *Client) PutWithAuth(ctx context.Context, url string, token string, body []byte, headers ...Header) (*http.Response, error)

func (*Client) Request

func (c *Client) Request(ctx context.Context, method, url string, body []byte, headers ...Header) (*http.Response, error)

func (*Client) RequestJSON

func (c *Client) RequestJSON(ctx context.Context, method, url string, data interface{}, headers ...Header) (*http.Response, error)
type Header struct {
	Key string
	Val string
}

Jump to

Keyboard shortcuts

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