httpclient

package
v0.0.0-...-fab9456 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDebug

func WithDebug(debug bool) func(*Client)

Types

type Client

type Client struct {
	Host string
	http.Client
	// contains filtered or unexported fields
}

func NewClient

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

func (*Client) Do

func (c *Client) Do(r *http.Request) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(endpoint string) (*http.Response, error)

func (*Client) Post

func (c *Client) Post(endpoint string, request interface{}, response interface{}) error

Post marshals a request to json and then posts it to an endpoint of the full node server

func (*Client) Send

func (c *Client) Send(method string, endpoint string, contentType string, body io.Reader) ([]byte, error)

type Option

type Option func(client *Client)

func WithRpcAuth

func WithRpcAuth(user, password string) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithTransport

func WithTransport(t *http.Transport) Option

Jump to

Keyboard shortcuts

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