Documentation ¶
Index ¶
- Variables
- func Register(name string, filter NewFilter)
- type Bencher
- type Context
- type Curl
- type DataFlow
- func (df *DataFlow) AutoDecodeBody() *DataFlow
- func (df *DataFlow) BindBody(obj interface{}) *DataFlow
- func (df *DataFlow) BindHeader(obj interface{}) *DataFlow
- func (df *DataFlow) BindJSON(obj interface{}) *DataFlow
- func (df *DataFlow) BindXML(obj interface{}) *DataFlow
- func (df *DataFlow) BindYAML(obj interface{}) *DataFlow
- func (df *DataFlow) Callback(cb func(*Context) error) *DataFlow
- func (df *DataFlow) Chunked() *DataFlow
- func (df *DataFlow) Code(httpCode *int) *DataFlow
- func (df *DataFlow) DELETE(url string) *DataFlow
- func (df *DataFlow) Debug(d ...interface{}) *DataFlow
- func (df *DataFlow) Do() (err error)
- func (df *DataFlow) E() *export
- func (df *DataFlow) Export() *export
- func (df *DataFlow) F() *filter
- func (df *DataFlow) Filter() *filter
- func (df *DataFlow) GET(url string) *DataFlow
- func (df *DataFlow) GetHost() (string, error)
- func (df *DataFlow) HEAD(url string) *DataFlow
- func (df *DataFlow) IsDebug() bool
- func (df *DataFlow) NoAutoContentType() *DataFlow
- func (df *DataFlow) OPTIONS(url string) *DataFlow
- func (df *DataFlow) PATCH(url string) *DataFlow
- func (df *DataFlow) POST(url string) *DataFlow
- func (df *DataFlow) PUT(url string) *DataFlow
- func (df *DataFlow) RequestUse(reqModify ...middler.RequestMiddler) *DataFlow
- func (df *DataFlow) ResponseUse(responseModify ...middler.ResponseMiddler) *DataFlow
- func (df *DataFlow) SetBasicAuth(username, password string) *DataFlow
- func (df *DataFlow) SetBody(obj interface{}) *DataFlow
- func (df *DataFlow) SetCookies(c ...*http.Cookie) *DataFlow
- func (df *DataFlow) SetForm(obj ...interface{}) *DataFlow
- func (df *DataFlow) SetGout(out *Gout)
- func (df *DataFlow) SetHeader(obj ...interface{}) *DataFlow
- func (df *DataFlow) SetHost(host string) *DataFlow
- func (df *DataFlow) SetJSON(obj interface{}) *DataFlow
- func (df *DataFlow) SetJSONNotEscape(obj interface{}) *DataFlow
- func (df *DataFlow) SetMethod(method string) *DataFlow
- func (df *DataFlow) SetProtoBuf(obj interface{}) *DataFlow
- func (df *DataFlow) SetProxy(proxyURL string) *DataFlow
- func (df *DataFlow) SetQuery(obj ...interface{}) *DataFlow
- func (df *DataFlow) SetRequest(req *http.Request) *DataFlow
- func (df *DataFlow) SetSOCKS5(addr string) *DataFlow
- func (df *DataFlow) SetSetting(s setting.Setting) *DataFlow
- func (df *DataFlow) SetTimeout(d time.Duration) *DataFlow
- func (df *DataFlow) SetURL(url string) *DataFlow
- func (df *DataFlow) SetWWWForm(obj ...interface{}) *DataFlow
- func (df *DataFlow) SetXML(obj interface{}) *DataFlow
- func (df *DataFlow) SetYAML(obj interface{}) *DataFlow
- func (df *DataFlow) UnixSocket(path string) *DataFlow
- func (df *DataFlow) WithContext(c context.Context) *DataFlow
- type Export
- type Filter
- type Gout
- type NewFilter
- type Req
- func (r *Req) Bind(req *http.Request, resp *http.Response) (err error)
- func (r *Req) Client() *http.Client
- func (r *Req) Do() (err error)
- func (r *Req) GetContext() context.Context
- func (r *Req) Request() (req *http.Request, err error)
- func (r *Req) Reset()
- func (r *Req) Response() (rsp *http.Response, err error)
- type Retry
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultClient The default http client, which has a connection pool DefaultClient = http.Client{} // DefaultBenchClient is the default http client used by the benchmark, // which has a connection pool DefaultBenchClient = http.Client{ Transport: &http.Transport{ MaxIdleConnsPerHost: 10000, }, } )
var GlobalSetting = setting.Setting{ NotIgnoreEmpty: true, }
存放全局配置选项
Functions ¶
Types ¶
type DataFlow ¶
type DataFlow struct { Req // contains filtered or unexported fields }
DataFlow is the core data structure, including the encoder and decoder of http data
func (*DataFlow) AutoDecodeBody ¶
https://github.com/xishengcai/gout/issues/343 content-encoding会指定response body的压缩方法,支持常用的压缩,gzip, deflate, br等
func (*DataFlow) BindBody ¶
BindBody parse the variables in http body to obj. obj must be a pointer variable
func (*DataFlow) BindHeader ¶
BindHeader parse http header to obj variable. obj must be a pointer variable Support string/int/float/slice ... types
func (*DataFlow) BindJSON ¶
BindJSON parse the json string in http body to obj. obj must be a pointer variable
func (*DataFlow) BindXML ¶
BindXML parse the xml string in http body to obj. obj must be a pointer variable
func (*DataFlow) BindYAML ¶
BindYAML parse the yaml string in http body to obj. obj must be a pointer variable
func (*DataFlow) Callback ¶
Callback parse the http body into obj according to the condition (json or string)
func (*DataFlow) E ¶
func (df *DataFlow) E() *export
E filter function, use this function to turn on the filter function
func (*DataFlow) Export ¶
func (df *DataFlow) Export() *export
Export filter function, use this function to turn on the filter function
func (*DataFlow) F ¶
func (df *DataFlow) F() *filter
F filter function, use this function to turn on the filter function
func (*DataFlow) Filter ¶
func (df *DataFlow) Filter() *filter
Filter filter function, use this function to turn on the filter function
func (*DataFlow) NoAutoContentType ¶
https://github.com/xishengcai/gout/issues/264 When calling SetWWWForm(), the Content-Type header will be added automatically, and calling NoAutoContentType() will not add an HTTP header
SetWWWForm "Content-Type", "application/x-www-form-urlencoded" SetJSON "Content-Type", "application/json"
func (*DataFlow) RequestUse ¶
func (df *DataFlow) RequestUse(reqModify ...middler.RequestMiddler) *DataFlow
Request middleware
func (*DataFlow) ResponseUse ¶
func (df *DataFlow) ResponseUse(responseModify ...middler.ResponseMiddler) *DataFlow
Response middleware
func (*DataFlow) SetBasicAuth ¶
SetBasicAuth
func (*DataFlow) SetCookies ¶
SetCookies set cookies
func (*DataFlow) SetJSON ¶
SetJSON send json to the http body, Support raw json(string, []byte)/struct/map types
func (*DataFlow) SetJSONNotEscape ¶
SetJSON send json to the http body, Support raw json(string, []byte)/struct/map types 与SetJSON的区一区别就是不转义HTML里面的标签
func (*DataFlow) SetProtoBuf ¶
SetProtoBuf send yaml to the http body, Support struct types obj必须是结构体指针或者[]byte类型
func (*DataFlow) SetQuery ¶
SetQuery send URL query string, Support string/[]byte/struct/map/slice types
func (*DataFlow) SetSetting ¶
SetSetting
func (*DataFlow) SetTimeout ¶
SetTimeout set timeout, and WithContext are mutually exclusive functions
func (*DataFlow) SetWWWForm ¶
SetWWWForm send x-www-form-urlencoded to the http body, Support struct/map/array/slice types
func (*DataFlow) UnixSocket ¶
UnixSocket 函数会修改Transport, 请像对待全局变量一样对待UnixSocket
type Req ¶
Req controls core data structure of http request
func (*Req) GetContext ¶
retry模块需要context.Context,所以这里也返回context.Context