https

package
v0.0.0-...-3122893 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2015 License: AGPL-3.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents HTTPS client connection with optional basic authentication

func NewAuthClient

func NewAuthClient(username, password string, tlsConfig *tls.Config) *Client

NewAuthClient returns new Client object with configured https transport and attached authentication. Parameter tlsConfig is optional and can be nil, the default TLSClientConfig of http.Transport will be used in this case.

func NewClient

func NewClient(tlsConfig *tls.Config) *Client

NewClient returns new Client object with transport configured for https. Parameter tlsConfig is optional and can be nil, the default TLSClientConfig of http.Transport will be used in this case.

func (*Client) ConnectTimeout

func (c *Client) ConnectTimeout(timeout time.Duration)

ConnectTimeout sets connection timeout

func (Client) Delete

func (c Client) Delete(url string, query url.Values, body io.Reader) (*Response, error)

Delete performs delete request to the url.

func (Client) Get

func (c Client) Get(url string, query url.Values) (*Response, error)

Get performs get request to the url.

func (Client) GetConnectTimeout

func (c Client) GetConnectTimeout() time.Duration

GetConnectTimeout returns connection timeout for the object

func (Client) GetReadWriteTimeout

func (c Client) GetReadWriteTimeout() time.Duration

GetReadWriteTimeout returns connection timeout for the object

func (*Client) Logger

func (c *Client) Logger(logger Logger)

Logger sets logger for http traces

func (Client) Post

func (c Client) Post(url string, query url.Values, body io.Reader) (*Response, error)

Post performs post request to the url.

func (*Client) ReadWriteTimeout

func (c *Client) ReadWriteTimeout(timeout time.Duration)

ReadWriteTimeout sets read-write timeout

type Logger

type Logger interface {
	Logf(format string, args ...interface{})
}

A Logger represents an active logging object to log Client communication

type Response

type Response struct {
	*http.Response
}

Response represents HTTPS client response

func (Response) Verify

func (r Response) Verify(code int, contentType string) error

Verify checks the response has specified code and body with specified content type

func (Response) VerifyCode

func (r Response) VerifyCode(code int) error

VerifyCode checks the response has specified code

func (Response) VerifyContentType

func (r Response) VerifyContentType(contentType string) error

VerifyContentType checks the response has specified content type

func (Response) VerifyJSON

func (r Response) VerifyJSON(code int) error

VerifyJSON checks the response has specified code and carries application/json body

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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