Documentation ¶
Index ¶
- Constants
- func DecodeBody(resp *http.Response, out interface{}) error
- func DefaultPooledTransport() *http.Transport
- func NewHttpClient(transport *http.Transport, tlsConf TLSConfig) (*http.Client, error)
- func SetupTLSConfig(tlsConfig *TLSConfig) (*tls.Config, error)
- func TextDecodeBody(resp *http.Response, out string) error
- func ValidateHostConn(config *Config) error
- func XmlDecodeBody(resp *http.Response, out interface{}) error
- type Client
- func (c *Client) DoNewRequest(method, path string) *request
- func (c *Client) NewDoRequest(r *request) (time.Duration, *http.Response, error)
- func (c *Client) SetBaseAuth(username, password string) *Client
- func (c *Client) SetTransport(transportFn func() *http.Transport) *Client
- func (c *Client) SetValidateHost(v bool) *Client
- type Config
- type HttpBasicAuth
- type Response
- type TLSConfig
Constants ¶
const ( // HTTPAddrEnvName defines an environment variable name which sets // the HTTP address if there is no -http-addr specified. HTTPAddrEnvName = "GUZZLE_HTTP_ADDR" // HTTPAuthEnvName defines an environment variable name which sets // the HTTP authentication header. HTTPAuthEnvName = "GUZZLE_HTTP_AUTH" // HTTPSSLEnvName defines an environment variable name which sets // whether or not to use HTTPS. HTTPSSLEnvName = "GUZZLE_HTTP_SSL" )
Variables ¶
This section is empty.
Functions ¶
func DecodeBody ¶
decodeBody is used to JSON decode a body
func DefaultPooledTransport ¶
DefaultPooledTransport returns a new http.Transport with similar default values to http.DefaultTransport. Do not use this for transient transports as it can leak file descriptors over time. Only use this for transports that will be re-used for the same host(s).
func NewHttpClient ¶
NewHttpClient returns an http client configured with the given Transport and TLS config.
func ValidateHostConn ¶
func XmlDecodeBody ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DoNewRequest ¶
DoNewRequest new a request is used to create a request struct
func (*Client) NewDoRequest ¶
NewDoRequest runs a request instance with http client
func (*Client) SetBaseAuth ¶ added in v1.0.4
func (*Client) SetTransport ¶ added in v1.0.4
func (*Client) SetValidateHost ¶ added in v1.0.4
type Config ¶
type Config struct { // Address is the address of the Guzzle core Address string // Scheme is the URI scheme for the Guzzle core Scheme string // Transport is the Transport to use for the http client. Transport *http.Transport // HttpClient is the client to use. Default will be // used if not provided. HttpClient *http.Client // HttpAuth is the auth info to use for http access. HttpAuth *HttpBasicAuth // WaitTime limits how long a Watch will block. If not provided, // the agent default values will be used. WaitTime time.Duration TLSConfig TLSConfig ValidateHost bool }
Config is used to configure the creation of a client
func DefaultConfig ¶
func DefaultConfig() *Config
type HttpBasicAuth ¶
type HttpBasicAuth struct { // Username to use for HTTP Basic Authentication Username string // Password to use for HTTP Basic Authentication Password string }
HttpBasicAuth is used to authenticate http client with HTTP Basic Authentication
type Response ¶
type Response struct { Duration time.Duration // StatusCode is the HTTP Status Code returned by the HTTP Response. Taken from resp.StatusCode. StatusCode int // Header stores the response headers as http.Header interface. Header http.Header // Cookies stores the parsed response cookies. Cookies []*http.Cookie // Expose the native Go http.Response object for convenience. RawResponse *http.Response // Expose original request Context for convenience. Context *context.Context Err error }
type TLSConfig ¶
type TLSConfig struct { // Address is the optional address of the Guzzle core. The port, if any // will be removed from here and this will be set to the ServerName of the // resulting config. Address string // CAFile is the optional path to the CA certificate used for Guzzle // communication, defaults to the system bundle if not specified. CAFile string // CAPath is the optional path to a directory of CA certificates to use for // Guzzle communication, defaults to the system bundle if not specified. CAPath string // CertFile is the optional path to the certificate for Guzzle // communication. If this is set then you need to also set KeyFile. CertFile string // KeyFile is the optional path to the private key for Guzzle communication. // If this is set then you need to also set CertFile. KeyFile string // InsecureSkipVerify if set to true will disable TLS host verification. InsecureSkipVerify bool }
TLSConfig is used to generate a TLSClientConfig that's useful for talking to Guzzle using TLS.