fasturl

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FastGet

func FastGet(url string, timeOut time.Duration) (*fasthttp.Response, error)

FastGet

func FastPost

func FastPost(url string, body []byte, timeOut time.Duration) (*fasthttp.Response, error)

FastPost

func FastPostString

func FastPostString(url string, body string, timeOut time.Duration) (*fasthttp.Response, error)

PostString

func PostFile

func PostFile(fieldname, filename, uri string) ([]byte, error)

PostFile 上传文件

func PostMultipartForm

func PostMultipartForm(fields []MultipartFormField, uri string) (respBody []byte, err error)

PostMultipartForm 上传文件或其他多个字段

func Upload

func Upload(client *http.Client, url string, values map[string]io.Reader) (err error)

Types

type Headers

type Headers struct {
	Accept         string `json:"Accept"`
	AcceptEncoding string `json:"Accept-Encoding"`
	AcceptLanguage string `json:"Accept-Language"`
	Connection     string `json:"Connection"`
	Cookie         string `json:"Cookie"`
	Dnt            string `json:"Dnt"`
	Host           string `json:"Host"`
	Referer        string `json:"Referer"`
	UserAgent      string `json:"User-Agent"`
}

type for http://httpbin.org for test only

type HttpBinHeaders

type HttpBinHeaders struct {
	Headers `json:"headers"`
}

type for http://httpbin.org for test only

type HttpbinPostBody

type HttpbinPostBody struct {
	Args struct {
	} `json:"args"`
	Data  string `json:"data"`
	Files struct {
	} `json:"files"`
	Form struct {
	} `json:"form"`
	Headers struct {
		Accept         string `json:"Accept"`
		AcceptEncoding string `json:"Accept-Encoding"`
		CacheControl   string `json:"Cache-Control"`
		Connection     string `json:"Connection"`
		ContentLength  string `json:"Content-Length"`
		ContentType    string `json:"Content-Type"`
		Host           string `json:"Host"`
		PostmanToken   string `json:"Postman-Token"`
		UserAgent      string `json:"User-Agent"`
	} `json:"headers"`
	JSON   interface{} `json:"json"`
	Origin string      `json:"origin"`
	URL    string      `json:"url"`
}

type for http://httpbin.org for test only

type IPbody

type IPbody struct {
	Origin string `json:"origin"`
}

type for http://httpbin.org for test only

type MultipartFormField

type MultipartFormField struct {
	IsFile    bool
	Fieldname string
	Value     []byte
	Filename  string
}

MultipartFormField 保存文件或其他字段信息

Jump to

Keyboard shortcuts

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