ht

package
v0.0.0-...-b0cbc73 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Default global instance of a custom http.Client using the defaults from the options package
	Default = DefaultHTTPClient()
	// UserAgent can be used to specify the User-Agent header sent on every request that used this package's
	// http.Client
	UserAgent = "planb-tokeninfo"
)

Functions

func DefaultHTTPClient

func DefaultHTTPClient() *http.Client

DefaultHTTPClient returns a new http.Client with KeepAlive disabled. That means no connection pooling. Use it only for one time requests where performance is not a concern It use some settings from the options package: options.HttpClientTimeout and options.HttpClientTlsTimeout

func Get

func Get(url string) (*http.Response, error)

Get issues a GET to the specified URL. It follows redirects, up to a maximum of 10

An error is returned if there were too many redirects or if there was an HTTP protocol error. A non-2xx response doesn't cause an error.

When err is nil, resp always contains a non-nil resp.Body. Caller should close resp.Body when done reading from it.

Get is a wrapper around Default.Get.

A User-Agent header is set for every request from the UserAgent variable in the same package

func NewHTTPClient

func NewHTTPClient(timeout time.Duration, tlsTimeout time.Duration) *http.Client

NewHTTPClient returns a new http.Client with specific timeouts from its arguments. KeepAlive is disabled. That means no connection pooling. Use it only for one time requests where performance is not a concern

Types

This section is empty.

Jump to

Keyboard shortcuts

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