Documentation
¶
Index ¶
- type BasicAuth
- type BearerAuth
- type BodyForm
- type BodyJSON
- type BodyString
- type BodyURLEncodedForm
- type BodyXML
- type BodyYAML
- type Cookies
- type CustomerAuth
- type FormFile
- type Header
- type Host
- type Method
- type Path
- type Plugin
- type Proxy
- type Query
- type Request
- func (r *Request) AddBasicAuth(username, password string) *Request
- func (r *Request) AddBearerAuth(data string) *Request
- func (r *Request) AddCookiesMap(data map[string]string) *Request
- func (r *Request) AddHeader(data map[string]string) *Request
- func (r *Request) AddJSON(data interface{}) *Request
- func (r *Request) AddMultipartForm(fields map[string]string, files []string) *Request
- func (r *Request) AddQuery(data map[string]string) *Request
- func (r *Request) AddSortedHeader(data [][2]string) *Request
- func (r *Request) AddTLSConfig(data *tls.Config) *Request
- func (r *Request) AddTransform(data *http.Transport) *Request
- func (r *Request) AddURLEncodedForm(data interface{}) *Request
- func (r *Request) AddXML(data interface{}) *Request
- func (r *Request) AddYAML(data interface{}) *Request
- func (r *Request) Ctx() *xcontext.Context
- func (r *Request) DELETE(url string) *Request
- func (r *Request) Error() error
- func (r *Request) GET(url string) *Request
- func (r *Request) HEAD(url string) *Request
- func (r *Request) OPTIONS(url string) *Request
- func (r *Request) PATCH(url string) *Request
- func (r *Request) POST(url string) *Request
- func (r *Request) PUT(url string) *Request
- func (r *Request) Send() *response.Sugar
- func (r *Request) TRACE(url string) *Request
- type SortedHeader
- type TLSConfig
- type Timeout
- type Transport
- type URL
- type UserAgent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicAuth ¶
BasicAuth http basic auth with username and password
type BodyURLEncodedForm ¶
type BodyURLEncodedForm struct {
Data interface{}
}
BodyURLEncodedForm application/x-www-form-urlencoded
func (BodyURLEncodedForm) Apply ¶
func (b BodyURLEncodedForm) Apply(ctx *xcontext.Context)
Apply application/x-www-form-urlencoded
func (BodyURLEncodedForm) Valid ¶
func (b BodyURLEncodedForm) Valid() bool
Valid application/x-www-form-urlencoded valid?
type CustomerAuth ¶
type CustomerAuth struct {
Data string
}
CustomerAuth customer Authorization on header
func (CustomerAuth) Apply ¶
func (c CustomerAuth) Apply(ctx *xcontext.Context)
Apply customer Authorization on header
func (CustomerAuth) Valid ¶
func (c CustomerAuth) Valid() bool
Valid customer Authorization on header valid?
type Host ¶
type Host struct {
Data string
}
Host http host name like: https://www.google.com
func (Host) Apply ¶
Apply http host name like: https://www.google.com
func (Host) Valid ¶
Valid http host name like: https://www.google.com valid?
type Method ¶
type Method struct {
Data string
}
Method http method: GET, POST, DELETE ...
type Plugin ¶
type Plugin interface { // Apply the plugin to http request Apply(*xcontext.Context) // Valid is the plugin need run? Valid() bool }
Plugin parse user defined request
type Proxy ¶
Proxy http proxy url or multi services
type Query ¶
Query http query params like: ?a=1&b=2
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request an alias of context
func NewWithContext ¶
func NewWithContext(ctx originContext.Context) *Request
NewWithContext request struct
func (*Request) AddBasicAuth ¶
AddBasicAuth ...
func (*Request) AddBearerAuth ¶
AddBearerAuth ...
func (*Request) AddCookiesMap ¶
AddCookiesMap ...
func (*Request) AddMultipartForm ¶
AddMultipartForm ...
func (*Request) AddSortedHeader ¶
AddSortedHeader ...
func (*Request) AddTLSConfig ¶
AddTLSConfig ...
func (*Request) AddTransform ¶
AddTransform ...
func (*Request) AddURLEncodedForm ¶
AddURLEncodedForm ...
type SortedHeader ¶
type SortedHeader struct {
Data [][2]string
}
SortedHeader header slice, example [][2]string{{k1,v1},{k2,v2}}
func (SortedHeader) Apply ¶
func (h SortedHeader) Apply(ctx *xcontext.Context)
Apply apply http headers
type TLSConfig ¶
TLSConfig http tls config of transport
type Timeout ¶
type Timeout struct { // Data represents the total timeout including dial / request / redirect steps Data time.Duration }
Timeout represents the supported timeouts