goreq

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = &http.Client{Transport: DefaultTransport}
View Source
var DefaultDialer = &net.Dialer{Timeout: 1000 * time.Millisecond}
View Source
var DefaultTransport http.RoundTripper = &http.Transport{Dial: DefaultDialer.Dial, Proxy: http.ProxyFromEnvironment}

Functions

func Deflate

func Deflate() *compression

func Gzip

func Gzip() *compression

func SetConnectTimeout

func SetConnectTimeout(duration time.Duration)

func Zlib

func Zlib() *compression

Types

type Body

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

func (*Body) Close

func (b *Body) Close() error

func (*Body) FromJsonTo

func (b *Body) FromJsonTo(o interface{}) error

func (*Body) Read

func (b *Body) Read(p []byte) (int, error)

func (*Body) ToString

func (b *Body) ToString() (string, error)

type Error

type Error struct {
	Err error
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Timeout

func (e *Error) Timeout() bool

type Request

type Request struct {
	Method            string
	Uri               string
	Body              interface{}
	QueryString       interface{}
	Timeout           time.Duration
	ContentType       string
	Accept            string
	Host              string
	UserAgent         string
	Insecure          bool
	MaxRedirects      int
	RedirectHeaders   bool
	Proxy             string
	Compression       *compression
	BasicAuthUsername string
	BasicAuthPassword string
	CookieJar         http.CookieJar
	ShowDebug         bool
	ShowDebugDetail   bool
	OnBeforeRequest   func(goreq *Request, httpreq *http.Request)
	// contains filtered or unexported fields
}

func (*Request) AddCookie

func (r *Request) AddCookie(c *http.Cookie)

func (*Request) AddHeader

func (r *Request) AddHeader(name string, value string)

func (Request) Do

func (r Request) Do() (*Response, error)

func (Request) NewRequest

func (r Request) NewRequest() (*http.Request, error)

func (*Request) UpdateHeader

func (r *Request) UpdateHeader(name string, value string)

func (Request) WithCookie

func (r Request) WithCookie(c *http.Cookie) Request

func (Request) WithHeader

func (r Request) WithHeader(name string, value string) Request

type Response

type Response struct {
	*http.Response
	Uri  string
	Body *Body
	// contains filtered or unexported fields
}

func (Response) CancelRequest

func (r Response) CancelRequest()

Jump to

Keyboard shortcuts

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