Documentation ¶
Index ¶
- func SetDefaultSetting(setting Settings)
- func TimeoutDialer(cTimeout time.Duration, rwTimeout time.Duration) func(net, addr string) (c net.Conn, err error)
- type Request
- func (r *Request) Body(data interface{}) *Request
- func (r *Request) Bytes() ([]byte, error)
- func (r *Request) Debug(isdebug bool) *Request
- func (r *Request) Header(key, value string) *Request
- func (r *Request) Headers() http.Header
- func (r *Request) Param(key, value string) *Request
- func (r *Request) PostFile(formname, filename string) *Request
- func (r *Request) Response() (*http.Response, error)
- func (r *Request) SetBasicAuth(username, password string) *Request
- func (r *Request) SetCookie(cookie *http.Cookie) *Request
- func (r *Request) SetEnableCookie(enable bool) *Request
- func (r *Request) SetProtocolVersion(vers string) *Request
- func (r *Request) SetProxy(proxy func(*http.Request) (*url.URL, error)) *Request
- func (r *Request) SetTLSClientConfig(config *tls.Config) *Request
- func (r *Request) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *Request
- func (r *Request) SetTransport(transport http.RoundTripper) *Request
- func (r *Request) SetUserAgent(useragent string) *Request
- func (r *Request) Setting(setting Settings) *Request
- func (r *Request) String() (string, error)
- func (r *Request) ToFile(filename string) error
- func (r *Request) ToJson(v interface{}) error
- func (r *Request) ToXml(v interface{}) error
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefaultSetting ¶ added in v0.5.0
func SetDefaultSetting(setting Settings)
Overwrite default settings
Types ¶
type Request ¶ added in v0.6.9
type Request struct {
// contains filtered or unexported fields
}
HttpRequest provides more useful methods for requesting one url than http.Request.
func (*Request) Bytes ¶ added in v0.6.9
Bytes returns the body []byte in response. it calls Response inner.
func (*Request) Param ¶ added in v0.6.9
Param adds query param in to request. params build query string as ?key1=value1&key2=value2...
func (*Request) Response ¶ added in v0.6.9
Response executes request client gets response mannually.
func (*Request) SetBasicAuth ¶ added in v0.6.9
SetBasicAuth sets the request's Authorization header to use HTTP Basic Authentication with the provided username and password.
func (*Request) SetEnableCookie ¶ added in v0.6.9
SetEnableCookie sets enable/disable cookiejar
func (*Request) SetProtocolVersion ¶ added in v0.6.9
Set the protocol version for incoming requests. Client requests always use HTTP/1.1.
func (*Request) SetProxy ¶ added in v0.6.9
Set http proxy example:
func(req *http.Request) (*url.URL, error) { u, _ := url.ParseRequestURI("http://127.0.0.1:8118") return u, nil }
func (*Request) SetTLSClientConfig ¶ added in v0.6.9
SetTLSClientConfig sets tls connection configurations if visiting https url.
func (*Request) SetTimeout ¶ added in v0.6.9
SetTimeout sets connect time out and read-write time out for BeegoRequest.
func (*Request) SetTransport ¶ added in v0.6.9
func (r *Request) SetTransport(transport http.RoundTripper) *Request
Set transport to
func (*Request) SetUserAgent ¶ added in v0.6.9
SetUserAgent sets User-Agent header field
func (*Request) String ¶ added in v0.6.9
String returns the body string in response. it calls Response inner.
func (*Request) ToFile ¶ added in v0.6.9
ToFile saves the body data in response to one file. it calls Response inner.