Documentation ¶
Index ¶
- Variables
- func Register(name string, filter NewFilter)
- func ToBodyType(s string) color.BodyType
- type Bencher
- type Context
- type Curl
- type 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) 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) Export() *export
- func (df *DataFlow) Filter() *filter
- func (df *DataFlow) GET(url string) *DataFlow
- func (df *DataFlow) HEAD(url string) *DataFlow
- func (df *DataFlow) IsDebug() bool
- 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) 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) SetProxy(proxyURL string) *DataFlow
- func (df *DataFlow) SetQuery(obj interface{}) *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 DebugFunc
- type DebugOpt
- type DebugOption
- 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) SetRequest(req *http.Request)
- 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, }, } )
Functions ¶
func ToBodyType ¶
ToBodyType Returns the http body type, which mainly affects color highlighting
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) 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
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) Export ¶
func (df *DataFlow) Export() *export
Export 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) SetCookies ¶
SetCookies set cookies
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
func (*DataFlow) UnixSocket ¶
UnixSocket 函数会修改Transport, 请像对待全局变量一样对待UnixSocket
type DebugFunc ¶
type DebugFunc func(*DebugOption)
DebugFunc DebugOpt is a function that manipulates core data structures
func (DebugFunc) Apply ¶
func (f DebugFunc) Apply(o *DebugOption)
Apply is an interface for operating DebugOption
type DebugOpt ¶
type DebugOpt interface {
Apply(*DebugOption)
}
DebugOpt is an interface for operating DebugOption
type DebugOption ¶
type DebugOption struct { Write io.Writer Debug bool Color bool ReqBodyType string RspBodyType string }
DebugOption Debug mode core data structure
type Req ¶
type Req struct { Err error // contains filtered or unexported fields }
Req controls core data structure of http request
func (*Req) GetContext ¶
func (*Req) Reset ¶
func (r *Req) Reset()
Reset 重置 Req结构体 req 结构布局说明,以decode为例 body 可以支持text, json, yaml, xml,所以定义成接口形式 headerDecode只有一个可能,就定义为具体类型。这里他们的decode实现也不一样 有没有必要,归一化成一种??? TODO: