goreq – github.com/franela/goreq Index | Files

package goreq

import "github.com/franela/goreq"

Index

Variables

var DefaultClient = &http.Client{Transport: DefaultTransport}
var DefaultDialer = &net.Dialer{Timeout: 1000 * time.Millisecond}
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
	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) AddProxyConnectHeader

func (r *Request) AddProxyConnectHeader(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) WithCookie

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

func (Request) WithHeader

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

func (Request) WithProxyConnectHeader

func (r Request) WithProxyConnectHeader(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()

Source Files

goreq.go tags.go

Version
v0.0.0-20171204163338-bcd34c9993f8 (latest)
Published
Dec 4, 2017
Platform
js/wasm
Imports
19 packages
Last checked
3 weeks ago

Tools for package owners.