web

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: GPL-3.0 Imports: 13 Imported by: 2 modules, 67 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRedirectAttempted = errors.New("redirect")

ErrRedirectAttempted indicates that a redirect occurred.

Functions

func NewHTTPClient

func NewHTTPClient(client Client) (*http.Client, error)

NewHTTPClient creates new HTTPClient.

func NewHTTPRequest

func NewHTTPRequest(req Request) (*http.Request, error)

NewHTTPRequest creates a new *http.Requests based on Request fields and returns *http.Requests and error if any encountered.

func NewTLSConfig added in v0.0.2

func NewTLSConfig(config ClientTLSConfig) (*tls.Config, error)

NewTLSConfig returns a tls.Config, may be nil without error if TLS is not configured.

Types

type Client

type Client struct {
	Timeout           Duration `yaml:"timeout"`              // default is zero (no timeout) must be tuned by modules
	NotFollowRedirect bool     `yaml:"not_follow_redirects"` // default is follow
	ProxyURL          string   `yaml:"proxy_url"`
	ClientTLSConfig   `yaml:",inline"`
}

Client is a struct that contains the fields that are needed fore creating HTTPClient.

type ClientTLSConfig added in v0.0.2

type ClientTLSConfig struct {
	TLSCA              string `yaml:"tls_ca"`
	TLSCert            string `yaml:"tls_cert"`
	TLSKey             string `yaml:"tls_key"`
	InsecureSkipVerify bool   `yaml:"tls_skip_verify"`
}

ClientTLSConfig represents the standard client TLS config.

type Duration

type Duration struct {
	Duration time.Duration
}

Duration is a time.Duration wrapper.

func (Duration) String added in v0.5.0

func (d Duration) String() string

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type HTTP

type HTTP struct {
	Request `yaml:",inline"`
	Client  `yaml:",inline"`
}

HTTP is a struct with embedded Request and Client.

type Request

type Request struct {
	URL           *url.URL          `yaml:"-"`
	UserURL       string            `yaml:"url"`
	Body          string            `yaml:"body"`
	Method        string            `yaml:"method"`
	Headers       map[string]string `yaml:"headers"`
	Username      string            `yaml:"username"`
	Password      string            `yaml:"password"`
	ProxyUsername string            `yaml:"proxy_username"`
	ProxyPassword string            `yaml:"proxy_password"`
}

Request is a struct that contains the fields that are needed to newHTTPClient *http.Request.

func (Request) Copy added in v0.5.0

func (r Request) Copy() Request

Copy makes full copy of Request.

func (*Request) ParseUserURL added in v0.5.0

func (r *Request) ParseUserURL() (err error)

ParseUserURL parses UserURL into *url.URL and sets URL.

Jump to

Keyboard shortcuts

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