client

package
v0.0.0-...-0322436 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckStatus

func CheckStatus(resp *http.Response, err error) (*http.Response, error)

CheckStatus is a helper that can be used around http.Do().

It checks, that the returned status code is 200.

Types

type Client

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

Client can send requests to the server.

func New

func New(addr, username, password string, options ...Option) (*Client, error)

New creates a client object. No requests are sent.

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do works like http.Client.Do().

Sets the csfr header.

func (*Client) Login

func (c *Client) Login() error

Login uses the username and password to login the client. Sets the returned cookie for later requests.

type Option

type Option func(*Client)

Option is an optional argument for New().

func WithLoginRetry

func WithLoginRetry(n int) Option

WithLoginRetry sets a number that login should retry befor failing.

Jump to

Keyboard shortcuts

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