Documentation
¶
Index ¶
- Variables
- 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) AddQuery(data map[string]string) *Request
- func (r *Request) AddTLSConfig(data *tls.Config) *Request
- func (r *Request) AddTransform(data http.RoundTripper) *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() *context.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 TLSConfig
- type Timeouts
- type Transport
- type URL
- type UserAgent
Constants ¶
This section is empty.
Variables ¶
var ( // DialTimeout represents the maximum amount of time the network dialer can take. DialTimeout = 30 * time.Second // DialKeepAlive represents the maximum amount of time too keep alive the socket. DialKeepAlive = 30 * time.Second // TLSHandshakeTimeout represents the maximum amount of time that // TLS handshake can take defined in the default http.Transport. TLSHandshakeTimeout = 10 * time.Second // RequestTimeout represents the maximum about of time that // a request can take, including dial / request / redirect processes. RequestTimeout = 60 * time.Second // DefaultDialer defines the default network dialer. DefaultDialer = &net.Dialer{ Timeout: DialTimeout, KeepAlive: DialKeepAlive, } )
Functions ¶
This section is empty.
Types ¶
type BasicAuth ¶
BasicAuth http basic auth with username and password
type BodyForm ¶ added in v1.0.8
BodyForm represents the supported form fields by file and string data.
type BodyURLEncodedForm ¶ added in v1.0.8
type BodyURLEncodedForm struct {
Data interface{}
}
BodyURLEncodedForm application/x-www-form-urlencoded
func (BodyURLEncodedForm) Apply ¶ added in v1.0.8
func (b BodyURLEncodedForm) Apply(ctx *context.Context)
Apply application/x-www-form-urlencoded
func (BodyURLEncodedForm) Valid ¶ added in v1.0.8
func (b BodyURLEncodedForm) Valid() bool
Valid application/x-www-form-urlencoded valid?
type BodyYAML ¶ added in v1.0.8
type BodyYAML struct {
Data interface{}
}
BodyYAML body of type yaml
type CustomerAuth ¶
type CustomerAuth struct {
Data string
}
CustomerAuth customer Authorization on header
func (CustomerAuth) Apply ¶
func (c CustomerAuth) Apply(ctx *context.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(*context.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 ¶ added in v1.0.8
type Request struct {
// contains filtered or unexported fields
}
Request an alias of context
func (*Request) AddBasicAuth ¶ added in v1.0.8
AddBasicAuth ...
func (*Request) AddBearerAuth ¶ added in v1.0.8
AddBearerAuth ...
func (*Request) AddCookiesMap ¶ added in v1.0.8
AddCookiesMap ...
func (*Request) AddTLSConfig ¶ added in v1.0.8
AddTLSConfig ...
func (*Request) AddTransform ¶ added in v1.0.8
func (r *Request) AddTransform(data http.RoundTripper) *Request
AddTransform ...
func (*Request) AddURLEncodedForm ¶ added in v1.0.8
AddURLEncodedForm ...
type TLSConfig ¶
TLSConfig http tls config of transport
type Timeouts ¶
type Timeouts struct {
// Request represents the total timeout including dial / request / redirect steps
Request time.Duration
// TLS represents the maximum amount of time for TLS handshake process
TLS time.Duration
// Dial represents the maximum amount of time for dialing process
Dial time.Duration
// KeepAlive represents the maximum amount of time to keep alive the socket
KeepAlive time.Duration
}
Timeouts represents the supported timeouts