Documentation ¶
Index ¶
- Constants
- Variables
- func QueryString(options interface{}) (qs string, err error)
- type BytesHandlerFunc
- type HandlerFunc
- type Requester
- func Delete(endpoint string) (*Requester, error)
- func Download(method, endpoint string, destination interface{}) (r *Requester, err error)
- func Get(endpoint string) (*Requester, error)
- func Patch(endpoint string) (*Requester, error)
- func Post(endpoint string) (*Requester, error)
- func Put(endpoint string) (*Requester, error)
- func Request(method, endpoint string) (r *Requester, err error)
- func Upload(method, endpoint string, files map[string]interface{}) (r *Requester, err error)
- func (r *Requester) Authenticate(username, password string) *Requester
- func (r *Requester) Bytes() ([]byte, error)
- func (r *Requester) Cancel()
- func (r *Requester) Cookie(cookies ...*http.Cookie) *Requester
- func (r *Requester) DebugPrintln() string
- func (r *Requester) Destination(destination interface{}) *Requester
- func (r *Requester) Do() (*bytes.Buffer, error)
- func (r *Requester) Encoding(t string) *Requester
- func (r *Requester) Files(files map[string]interface{}) *Requester
- func (r *Requester) Form(files map[string]interface{}, fields map[string]string) *Requester
- func (r *Requester) JSON(v interface{}) (err error)
- func (r *Requester) Parameters(data interface{}) *Requester
- func (r *Requester) Pipe()
- func (r *Requester) Println() string
- func (r *Requester) Progress(f progress.HandlerFunc) *Requester
- func (r *Requester) Query(data interface{}) *Requester
- func (r *Requester) Response(handler HandlerFunc) *Requester
- func (r *Requester) ResponseBytes(handler BytesHandlerFunc) *Requester
- func (r *Requester) ResponseJSON(f interface{}) *Requester
- func (r *Requester) ResponseString(handler StringHandlerFunc) *Requester
- func (r *Requester) Set(key, value string) *Requester
- func (r *Requester) String() (string, error)
- func (r *Requester) TLSConfig(t *tls.Config) *Requester
- func (r *Requester) Timeout(t time.Duration) *Requester
- func (r *Requester) ValidateStatusCode(statusCodes ...int) (b bool)
- type StringHandlerFunc
Constants ¶
View Source
const ( OPTIONS = "OPTIONS" GET = "GET" HEAD = "HEAD" POST = "POST" PUT = "PUT" PATCH = "PATCH" DELETE = "DELETE" TRACE = "TRACE" CONNECT = "CONNECT" )
Methods.
HTTP method definitions. See http://tools.ietf.org/html/rfc7231#section-4.3
Variables ¶
View Source
var Methods = map[string]string{ OPTIONS: OPTIONS, GET: GET, HEAD: HEAD, POST: POST, PUT: PUT, PATCH: PATCH, DELETE: DELETE, TRACE: TRACE, CONNECT: CONNECT, }
Method map.
Functions ¶
func QueryString ¶
Types ¶
type Requester ¶
type Requester struct { // HTTP method Method string // Base URL for Requests. Endpoint string Url *url.URL Header http.Header Body io.ReadCloser Length int64 StatusCode int Buffer *bytes.Buffer // Upload IsUpload bool // Download IsDownload bool // contains filtered or unexported fields }
A Request manages communication with http service.
func (*Requester) Authenticate ¶
func (*Requester) DebugPrintln ¶
func (*Requester) Destination ¶
func (*Requester) Parameters ¶
func (*Requester) Response ¶
func (r *Requester) Response(handler HandlerFunc) *Requester
func (*Requester) ResponseBytes ¶
func (r *Requester) ResponseBytes(handler BytesHandlerFunc) *Requester
func (*Requester) ResponseJSON ¶
func (*Requester) ResponseString ¶
func (r *Requester) ResponseString(handler StringHandlerFunc) *Requester
func (*Requester) ValidateStatusCode ¶
Status Code
Click to show internal directories.
Click to hide internal directories.