morse

package
v0.0.0-...-087bed1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: MIT Imports: 7 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 {
	HTTP *http.Client
}

func NewClient

func NewClient(certificates ...string) (*Client, error)

NewClient sets up a new libhttp.Client. The client has http.Client's default values with the following exceptions: HTTP2 is forced; TLS12 or greater; additional RootCAs from provided files and from predefined authorities. Takes none or more optional files to add as certificates to the client.

func (Client) Do

func (client Client) Do(req *http.Request, dst ...interface{}) error

Do is a wrapper around http.do that error checks and decodes the response to the (optional) destination. 'dst' is an optional destination pointer that must be either implementing io.writer or a struct to be populated by JSON data. As 'dst' is a variadic argument, multiple 'dst' may be passed. However; any additional destinations are ignored with no error.

func (Client) Get

func (client Client) Get(url string, dst ...interface{}) error

Get is a simplified way to do a HTTP GET request by just having a url and (optionally) a destination for the response. 'dst' is an optional destination pointer that must be either implementing io.writer or a struct to be populated by JSON data. As 'dst' is a variadic argument, multiple 'dst' may be passed. However; any additional destinations are ignored with no error.

func (Client) PostForm

func (client Client) PostForm(url string, data map[string][]string, dst ...interface{}) error

PostForm is a wrapper around http.PostForm that takes a map as input, and makes error checks and decodes the response to the (optional) destination. 'dst' is an optional destination pointer that must be either implementing io.writer or a struct to be populated by JSON data. As 'dst' is a variadic argument, multiple 'dst' may be passed. However; any additional destinations are ignored with no error.

type Transmitter

type Transmitter interface {
	Do(req *http.Request, dst ...interface{}) error
	Get(url string, dst ...interface{}) error
	PostForm(url string, data map[string][]string, dst ...interface{}) error
}

Transmitter expl

Jump to

Keyboard shortcuts

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