http

package
v0.0.0-...-8d1786a Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildBasicAuthHeader

func BuildBasicAuthHeader(username string, password string) string

BuildBasicAuthHeader builds an auth header needed for Basic Authentication

Types

type RestHelper

type RestHelper struct {
	// contains filtered or unexported fields
}

RestHelper provides an easy interface to send requests to a REST endpoint

func NewRestHelper

func NewRestHelper(baseURL string, authorizationHeader string) *RestHelper

NewRestHelper returns an instance of RestHelper

func NewRestHelperWithTimeout

func NewRestHelperWithTimeout(baseURL string, authorizationHeader string,
	timeout time.Duration) *RestHelper

func (*RestHelper) SendRequest

func (h *RestHelper) SendRequest(endpointName string, method string, params *url.Values,
	payload interface{}) ([]byte, error)

SendRequest generates an HTTP request to the REST endpoint

func (*RestHelper) SendRequestToURL

func (h *RestHelper) SendRequestToURL(url string, method string, params *url.Values,
	payload interface{}) ([]byte, error)

SendRequestToURL generates an HTTP request to the given URL.

func (*RestHelper) SendRequestToURLWithRetry

func (h *RestHelper) SendRequestToURLWithRetry(url string, method string, params *url.Values,
	payload interface{}, maxAttempts int, baseWaitMs int) ([]byte, error)

SendRequestToURLWithRetry generates a HTTP request to a URL with retries

func (*RestHelper) SendRequestWithRetry

func (h *RestHelper) SendRequestWithRetry(endpointName string, method string, params *url.Values,
	payload interface{}, maxAttempts int, baseWaitMs int) ([]byte, error)

SendRequestWithRetry generates an HTTP request to the REST endpoint with retries

Jump to

Keyboard shortcuts

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