httpbase

package
v0.0.0-...-1e93fd1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client = &http.Client{
	Timeout: time.Duration(5) * time.Second,
	CheckRedirect: func(req *http.Request, via []*http.Request) (err error) {
		if req != nil && via != nil && len(via) > 0 {
			if len(via) >= 10 {
				return errors.New("stopped after 10 redirects")
			}
			req.Header = via[0].Header
		}
		return nil
	},
}

Functions

func Get

func Get(uri string, header map[string]string) (*http.Response, error, error)

func GetBytes

func GetBytes(uri string, header map[string]string) (code int, buff []byte, err, neterr error)

func GetUserAgent

func GetUserAgent() string

func PostData

func PostData(uri string, header map[string]string, data io.Reader) (*http.Response, error, error)

func PostForm

func PostForm(uri string, header map[string]string, val url.Values) (*http.Response, error, error)

func PostJson

func PostJson(uri string, header map[string]string, data interface{}) (*http.Response, error, error)

func PutJson

func PutJson(uri string, header map[string]string, data interface{}) (*http.Response, error, error)

func SetProxy

func SetProxy(rawurl string) (err error)

func SetRootCA

func SetRootCA(file string) (err error)

func SetSkipVerify

func SetSkipVerify(skip bool) (err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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