Documentation
¶
Index ¶
- func SetDnsCache(resolver *dnscache.Resolver)
- type FileUpload
- type RequestOptions
- type Response
- func Delete(url string, ro *RequestOptions) (*Response, error)
- func Get(url string, ro *RequestOptions) (*Response, error)
- func Head(url string, ro *RequestOptions) (*Response, error)
- func Options(url string, ro *RequestOptions) (*Response, error)
- func Patch(url string, ro *RequestOptions) (*Response, error)
- func Post(url string, ro *RequestOptions) (*Response, error)
- func Put(url string, ro *RequestOptions) (*Response, error)
- func Request(method, url string, ro *RequestOptions) (*Response, error)
- func (self *Response) Byte() []byte
- func (self *Response) Close() error
- func (self *Response) CookiesMap() map[string]string
- func (self *Response) GetHeader(headerName string) string
- func (self *Response) HasCookie(cookieName string) bool
- func (self *Response) HasCookieAndValue(cookieName, cookieVaule string) bool
- func (self *Response) HasHeader(headerName string) bool
- func (self *Response) HasHeaderAndValue(headerName, headerVaule string) bool
- func (self *Response) HeadersMap() map[string]string
- func (self *Response) RawCookies() string
- func (self *Response) RawHeaders() string
- func (self *Response) RawRequest() string
- func (self *Response) ReadN(n int64) []byte
- func (self *Response) StatusCode() int
- func (self *Response) String() string
- type Session
- func (s *Session) Delete(url string, ro *RequestOptions) (*Response, error)
- func (s *Session) Get(url string, ro *RequestOptions) (*Response, error)
- func (s *Session) Head(url string, ro *RequestOptions) (*Response, error)
- func (s *Session) Options(url string, ro *RequestOptions) (*Response, error)
- func (s *Session) Patch(url string, ro *RequestOptions) (*Response, error)
- func (s *Session) Post(url string, ro *RequestOptions) (*Response, error)
- func (s *Session) Put(url string, ro *RequestOptions) (*Response, error)
- func (s *Session) Request(method string, url string, ro *RequestOptions) (*Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDnsCache ¶
Types ¶
type FileUpload ¶
type FileUpload struct {
// Filename is the name of the file that you wish to upload. We use this to guess the mimetype as well as pass it onto the server
FileName string
// FileContents is happy as long as you pass it a io.ReadCloser (which most file use anyways)
FileContents io.ReadCloser
// FieldName is form field name
FieldName string
// FileMime represents which mimetime should be sent along with the file.
// When empty, defaults to application/octet-stream
FileMime string
}
func FileUploadFromDisk ¶
func FileUploadFromDisk(fieldName, filePath string) ([]FileUpload, error)
type RequestOptions ¶
type RequestOptions struct {
// Data is a map of key values that will eventually convert into the
// query string of a GET request or the body of a POST request.
Data map[string]string
// Params is a map of query strings that may be used within a GET request
Params map[string]string
// Files is where you can include files to upload. The use of this data
// structure is limited to POST requests
Files []FileUpload
// JSON can be used when you wish to send JSON within the request body
JSON interface{}
// XML can be used if you wish to send XML within the request body
XML interface{}
// Headers if you want to add custom HTTP headers to the request,
// this is your friend
Headers map[string]string
// InsecureSkipVerify is a flag that specifies if we should validate the
// server's TLS certificate. It should be noted that Go's TLS verify mechanism
// doesn't validate if a certificate has been revoked
InsecureSkipVerify bool
// DisableCompression will disable gzip compression on requests
DisableCompression bool
// Host allows you to set an arbitrary custom host
Host string
// Set custom dns resolution for the current request
Hosts string
ContentType string
UserAgent string
// Auth allows you to specify a user name and password that you wish to
// use when requesting the URL. It will use basic HTTP authentication
// formatting the username and password in base64 the format is:
// []string{username, password}
Auth []string
// Cookies is an array of `http.Cookie` that allows you to attach
// cookies to your request
Cookies map[string]string
// Proxies is a map in the following format
// *protocol* => proxy address e.g http => http://127.0.0.1:8080
Proxies map[string]*url.URL
// DialTimeout is the maximum amount of time a dial will wait for
// a connect to complete.
DialTimeout time.Duration
// RequestTimeout is the maximum amount of time a whole request(include dial / request / redirect)
// will wait.
RequestTimeout time.Duration
DisableRedirect bool
RawCookie string
RawQuery string
RawData string
IsAjax bool
}
type Response ¶
func (*Response) CookiesMap ¶
func (*Response) HasCookieAndValue ¶
func (*Response) HasHeaderAndValue ¶
func (*Response) HeadersMap ¶
func (*Response) RawCookies ¶
func (*Response) RawHeaders ¶
func (*Response) RawRequest ¶
func (*Response) StatusCode ¶
Click to show internal directories.
Click to hide internal directories.