Documentation ¶
Index ¶
- func TimeoutDialer(cTimeout time.Duration, rwTimeout time.Duration) func(net, addr string) (c net.Conn, err error)
- type BeegoHttpRequest
- func (b *BeegoHttpRequest) Body(data interface{}) *BeegoHttpRequest
- func (b *BeegoHttpRequest) Bytes() ([]byte, error)
- func (b *BeegoHttpRequest) Debug(isdebug bool) *BeegoHttpRequest
- func (b *BeegoHttpRequest) Header(key, value string) *BeegoHttpRequest
- func (b *BeegoHttpRequest) Param(key, value string) *BeegoHttpRequest
- func (b *BeegoHttpRequest) Response() (*http.Response, error)
- func (b *BeegoHttpRequest) SetCookie(cookie *http.Cookie) *BeegoHttpRequest
- func (b *BeegoHttpRequest) SetProxy(proxy func(*http.Request) (*url.URL, error)) *BeegoHttpRequest
- func (b *BeegoHttpRequest) SetTLSClientConfig(config *tls.Config) *BeegoHttpRequest
- func (b *BeegoHttpRequest) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *BeegoHttpRequest
- func (b *BeegoHttpRequest) SetTransport(transport http.RoundTripper) *BeegoHttpRequest
- func (b *BeegoHttpRequest) String() (string, error)
- func (b *BeegoHttpRequest) ToFile(filename string) error
- func (b *BeegoHttpRequest) ToJson(v interface{}) error
- func (b *BeegoHttpRequest) ToXML(v interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BeegoHttpRequest ¶
type BeegoHttpRequest struct {
// contains filtered or unexported fields
}
BeegoHttpRequest provides more useful methods for requesting one url than http.Request.
func Delete ¶
func Delete(url string) *BeegoHttpRequest
Delete returns *BeegoHttpRequest DELETE GET method.
func Head ¶
func Head(url string) *BeegoHttpRequest
Head returns *BeegoHttpRequest with HEAD method.
func Post ¶
func Post(url string) *BeegoHttpRequest
Post returns *BeegoHttpRequest with POST method.
func (*BeegoHttpRequest) Body ¶
func (b *BeegoHttpRequest) Body(data interface{}) *BeegoHttpRequest
Body adds request raw body. it supports string and []byte.
func (*BeegoHttpRequest) Bytes ¶
func (b *BeegoHttpRequest) Bytes() ([]byte, error)
Bytes returns the body []byte in response. it calls Response inner.
func (*BeegoHttpRequest) Debug ¶
func (b *BeegoHttpRequest) Debug(isdebug bool) *BeegoHttpRequest
Debug sets show debug or not when executing request.
func (*BeegoHttpRequest) Header ¶
func (b *BeegoHttpRequest) Header(key, value string) *BeegoHttpRequest
Header add header item string in request.
func (*BeegoHttpRequest) Param ¶
func (b *BeegoHttpRequest) Param(key, value string) *BeegoHttpRequest
Param adds query param in to request. params build query string as ?key1=value1&key2=value2...
func (*BeegoHttpRequest) Response ¶
func (b *BeegoHttpRequest) Response() (*http.Response, error)
Response executes request client gets response mannually.
func (*BeegoHttpRequest) SetCookie ¶
func (b *BeegoHttpRequest) SetCookie(cookie *http.Cookie) *BeegoHttpRequest
SetCookie add cookie into request.
func (*BeegoHttpRequest) SetProxy ¶
func (b *BeegoHttpRequest) SetProxy(proxy func(*http.Request) (*url.URL, error)) *BeegoHttpRequest
Set http proxy example:
func(req *http.Request) (*url.URL, error) { u, _ := url.ParseRequestURI("http://127.0.0.1:8118") return u, nil }
func (*BeegoHttpRequest) SetTLSClientConfig ¶
func (b *BeegoHttpRequest) SetTLSClientConfig(config *tls.Config) *BeegoHttpRequest
SetTLSClientConfig sets tls connection configurations if visiting https url.
func (*BeegoHttpRequest) SetTimeout ¶
func (b *BeegoHttpRequest) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *BeegoHttpRequest
SetTimeout sets connect time out and read-write time out for BeegoRequest.
func (*BeegoHttpRequest) SetTransport ¶
func (b *BeegoHttpRequest) SetTransport(transport http.RoundTripper) *BeegoHttpRequest
Set transport to
func (*BeegoHttpRequest) String ¶
func (b *BeegoHttpRequest) String() (string, error)
String returns the body string in response. it calls Response inner.
func (*BeegoHttpRequest) ToFile ¶
func (b *BeegoHttpRequest) ToFile(filename string) error
ToFile saves the body data in response to one file. it calls Response inner.
func (*BeegoHttpRequest) ToJson ¶
func (b *BeegoHttpRequest) ToJson(v interface{}) error
ToJson returns the map that marshals from the body bytes as json in response . it calls Response inner.
func (*BeegoHttpRequest) ToXML ¶
func (b *BeegoHttpRequest) ToXML(v interface{}) error
ToXml returns the map that marshals from the body bytes as xml in response . it calls Response inner.