helper

package
v5.6.10+incompatible Latest Latest
Warning

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

Go to latest
Published: May 9, 2018 License: Apache-2.0 Imports: 11 Imported by: 5,435

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

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

func NewHTTP

func NewHTTP(base mb.BaseMetricSet) *HTTP

NewHTTP creates new http helper

func (*HTTP) FetchContent

func (h *HTTP) FetchContent() ([]byte, error)

FetchContent makes an HTTP request to the configured url and returns the body content.

func (*HTTP) FetchJSON

func (h *HTTP) FetchJSON() (map[string]interface{}, error)

FetchJSON makes an HTTP request to the configured url and returns the JSON content. This only works if the JSON output needed is in map[string]interface format.

func (*HTTP) FetchResponse

func (h *HTTP) FetchResponse() (*http.Response, error)

FetchResponse fetches a response for the http metricset. It's important that resp.Body has to be closed if this method is used. Before using this method check if one of the other Fetch* methods could be used as they ensure that the Body is properly closed.

func (*HTTP) FetchScanner

func (h *HTTP) FetchScanner() (*bufio.Scanner, error)

FetchScanner returns a Scanner for the content.

func (*HTTP) SetBody

func (h *HTTP) SetBody(body []byte)

func (*HTTP) SetHeader

func (h *HTTP) SetHeader(key, value string)

func (*HTTP) SetMethod

func (h *HTTP) SetMethod(method string)

Jump to

Keyboard shortcuts

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