rawhttp

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: MIT Imports: 14 Imported by: 87

README

rawhttp

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = Client{
	// contains filtered or unexported fields
}
View Source
var DefaultOptions = Options{
	Timeout:                30 * time.Second,
	FollowRedirects:        true,
	MaxRedirects:           10,
	AutomaticHostHeader:    true,
	AutomaticContentLength: true,
}
View Source
var DefaultPipelineOptions = PipelineOptions{
	Timeout:             30 * time.Second,
	MaxConnections:      5,
	AutomaticHostHeader: true,
}

Functions

func AutomaticContentLength

func AutomaticContentLength(enable bool)

func AutomaticHostHeader

func AutomaticHostHeader(enable bool)

func Do

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

func DoRaw

func DoRaw(method, url, uripath string, headers map[string][]string, body io.Reader) (*http.Response, error)

func Dor

func Dor(req *retryablehttp.Request) (*http.Response, error)

func Get

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

func Post

func Post(url string, mimetype string, r io.Reader) (*http.Response, error)

Types

type Client

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

func NewClient

func NewClient(options Options) *Client

func (*Client) Do

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

func (*Client) DoRaw

func (c *Client) DoRaw(method, url, uripath string, headers map[string][]string, body io.Reader) (*http.Response, error)

func (*Client) Dor

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

func (*Client) Get

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

func (*Client) Head

func (c *Client) Head(url string) (*http.Response, error)

func (*Client) Post

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

type Conn

type Conn interface {
	client.Client
	io.Closer

	SetDeadline(time.Time) error
	SetReadDeadline(time.Time) error
	SetWriteDeadline(time.Time) error
	Release()
}

type Dialer

type Dialer interface {
	// Dial dials a remote http server returning a Conn.
	Dial(protocol, addr string) (Conn, error)
}

Dialer can dial a remote HTTP server.

type Options

type Options struct {
	Timeout                time.Duration
	FollowRedirects        bool
	MaxRedirects           int
	AutomaticHostHeader    bool
	AutomaticContentLength bool
}

type PipelineClient

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

func NewPipelineClient

func NewPipelineClient(options PipelineOptions) *PipelineClient

func (*PipelineClient) Do

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

func (*PipelineClient) DoRaw

func (c *PipelineClient) DoRaw(method, url, uripath string, headers map[string][]string, body io.Reader) (*http.Response, error)

func (*PipelineClient) Dor

func (*PipelineClient) Get

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

func (*PipelineClient) Head

func (c *PipelineClient) Head(url string) (*http.Response, error)

func (*PipelineClient) Post

func (c *PipelineClient) Post(url string, mimetype string, body io.Reader) (*http.Response, error)

type PipelineOptions

type PipelineOptions struct {
	Host                string
	Timeout             time.Duration
	MaxConnections      int
	MaxPendingRequests  int
	AutomaticHostHeader bool
}

type RedirectStatus

type RedirectStatus struct {
	FollowRedirects bool
	MaxRedirects    int
	Current         int
}

type StatusError

type StatusError struct {
	client.Status
}

func (*StatusError) Error

func (s *StatusError) Error() string

Directories

Path Synopsis
example
client command
server command

Jump to

Keyboard shortcuts

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