http

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: Apache-2.0 Imports: 10 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 a HTTP client.

func NewClient

func NewClient(endpoint string, opts ...Option) (*Client, error)

NewClient returns a Client with initializations.

func (*Client) DoRequest

func (c *Client) DoRequest(ctx context.Context, method, path string, headers map[string]string, body interface{}) (*http.Response, error)

DoRequest does HTTP request, wrapping http.Client.Do. The body is assumed to be JSON.

type Option

type Option func(*Client)

Option represents a option for Client constructor.

func WithLogger

func WithLogger(l *zap.Logger) Option

WithLogger returns Option which sets an optional logger for Client.

func WithTimeout

func WithTimeout(t time.Duration) Option

WithTimeout returns Option which sets an optional timeout for Client.

Jump to

Keyboard shortcuts

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