Documentation ¶
Index ¶
- Constants
- Variables
- type H
- type Handler
- type Request
- func Connect(uri string) (*Request, error)
- func Delete(uri string) (*Request, error)
- func Get(uri string) (*Request, error)
- func Head(uri string) (*Request, error)
- func NewRequest(method, uri string) (r *Request, err error)
- func Options(uri string) (*Request, error)
- func Patch(uri string) (*Request, error)
- func Post(uri string) (*Request, error)
- func Put(uri string) (*Request, error)
- func Trace(uri string) (*Request, error)
- func (r *Request) AddHeader(key, value string) *Request
- func (r *Request) Do() (*Response, error)
- func (r *Request) GetHeaders() H
- func (r *Request) Method() string
- func (r *Request) SetBasicAuth(username, password string) *Request
- func (r *Request) SetBody(body io.Reader) *Request
- func (r *Request) SetCookie(cookie *http.Cookie) *Request
- func (r *Request) SetDebug(d bool) *Request
- func (r *Request) SetForm(v url.Values) *Request
- func (r *Request) SetHeader(key, value string) *Request
- func (r *Request) SetHeaders(headers map[string]string) *Request
- func (r *Request) SetJSON(v interface{}) *Request
- func (r *Request) SetPrintBody(d bool) *Request
- func (r *Request) SetProxy(proxyURL string) *Request
- func (r *Request) SetRedirects(i bool) *Request
- func (r *Request) SetReferer(referer string) *Request
- func (r *Request) SetTimeOut(d time.Duration) *Request
- func (r *Request) SetUserAgent(value string) *Request
- func (r *Request) URL() *url.URL
- func (r *Request) URLString() string
- type Response
- func (r *Response) GetBody() []byte
- func (r *Response) GetCookies() []*http.Cookie
- func (r *Response) GetHeader(key string) string
- func (r *Response) GetHeaders() H
- func (r *Response) GetJSON(v interface{}) error
- func (r *Response) GetRequest() *Request
- func (r *Response) GetStatus() int
- func (r *Response) String() string
Constants ¶
View Source
const (
// Version
Version = "v0.1.0"
)
Variables ¶
View Source
var DefaultRequestTimeOut = 5 * time.Second
DefaultRequestTimeOut set a default request time out
View Source
var NoMatchHttpMethod = errors.New("no match request method")
NoMatchHttpMethod is errors
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) SetBasicAuth ¶
SetBasicAuth set username and password to header
func (*Request) SetHeaders ¶
SetHeaders multi set request header
func (*Request) SetPrintBody ¶
SetPrintBody set debug mode rely Debug
func (*Request) SetRedirects ¶
SetRedirects set default request allow redirects
func (*Request) SetReferer ¶
SetReferer set a referer request header
func (*Request) SetTimeOut ¶
SetTimeOut set default request time
func (*Request) SetUserAgent ¶
SetUserAgent set user-agent
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response r
func (*Response) GetCookies ¶
GetCookies returns response cookies slice
func (*Response) GetRequest ¶
GetRequest returns initial request
Source Files ¶
Click to show internal directories.
Click to hide internal directories.