http

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(reqURI string, opts ...Option) (int, []byte, error)

func Post

func Post(reqURI string, data []byte, opts ...Option) (int, []byte, error)

Post sends http post

Types

type Client

type Client struct {
	BaseURL *url.URL
	// contains filtered or unexported fields
}

Client manages client side of http request

func NewClient

func NewClient(baseURL string, opts ...Option) *Client

NewClient creates http client

func (*Client) Get

func (c *Client) Get(reqURI string, opts ...Option) (int, []byte, error)

Get sends http get

func (*Client) Post

func (c *Client) Post(reqURI string, data []byte, opts ...Option) (int, []byte, error)

Post sends http post

type Option

type Option func(client *Client)

func WithBasicAuth

func WithBasicAuth(username, password string) Option

func WithContext

func WithContext(ctx context.Context) Option

func WithHeader

func WithHeader(key, value string) Option

func WithSkipTLSVerify

func WithSkipTLSVerify() Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

Jump to

Keyboard shortcuts

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