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 ¶
func SetDefaultSetting(setting Settings)
SetDefaultSetting overwrites default settings
Types ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request provides more useful methods for requesting one url than http.Request.
func (*Request) Param ¶
Param adds query param in to request. params build query string as ?key1=value1&key2=value2...
func (*Request) SetBasicAuth ¶
SetBasicAuth sets the request's Authorization header to use HTTP Basic Authentication with the provided username and password.
func (*Request) SetEnableCookie ¶
SetEnableCookie sets enable/disable cookiejar
func (*Request) SetProtocolVersion ¶
SetProtocolVersion sets the protocol version for incoming requests. Client requests always use HTTP/1.1.
func (*Request) SetProxy ¶
SetProxy sets 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 ¶
SetTLSClientConfig sets tls connection configurations if visiting https url.
func (*Request) SetTimeout ¶
SetTimeout sets connect time out and read-write time out for BeegoRequest.
func (*Request) SetTransport ¶
func (r *Request) SetTransport(transport http.RoundTripper) *Request
SetTransport sets transport to
func (*Request) SetUserAgent ¶
SetUserAgent sets User-Agent header field
func (*Request) ToFile ¶
ToFile saves the body data in response to one file. it calls Response inner.