Documentation
¶
Index ¶
- Constants
- Variables
- type Agent
- func (s *Agent) AddCookie(c *http.Cookie) *Agent
- func (s *Agent) AddCookies(cookies []*http.Cookie) *Agent
- func (s *Agent) AppendHeader(param string, value string) *Agent
- func (s *Agent) AsCurlCommand() (string, error)
- func (s *Agent) ClearSuperAgent()
- func (s *Agent) Clone() *Agent
- func (s *Agent) CustomMethod(method, targetUrl string) *Agent
- func (s *Agent) Delete(targetUrl string) *Agent
- func (s *Agent) End(callback ...func(response Response, body string, errs []error)) (Response, string, []error)
- func (s *Agent) EndBytes(callback ...func(response Response, body []byte, errs []error)) (Response, []byte, []error)
- func (s *Agent) EndStruct(v interface{}, ...) (Response, []byte, []error)
- func (s *Agent) Get(targetUrl string) *Agent
- func (s *Agent) Head(targetUrl string) *Agent
- func (s *Agent) MakeRequest() (*http.Request, error)
- func (s *Agent) Options(targetUrl string) *Agent
- func (s *Agent) Param(key string, value string) *Agent
- func (s *Agent) Patch(targetUrl string) *Agent
- func (s *Agent) Post(targetUrl string) *Agent
- func (s *Agent) Proxy(proxyUrl string) *Agent
- func (s *Agent) Put(targetUrl string) *Agent
- func (s *Agent) Query(content interface{}) *Agent
- func (s *Agent) RedirectPolicy(policy func(req Request, via []Request) error) *Agent
- func (s *Agent) Retry(retryerCount int, retryerTime time.Duration, statusCode ...int) *Agent
- func (s *Agent) Send(content interface{}) *Agent
- func (s *Agent) SendFile(file interface{}, args ...interface{}) *Agent
- func (s *Agent) SendMap(content interface{}) *Agent
- func (s *Agent) SendSlice(content []interface{}) *Agent
- func (s *Agent) SendString(content string) *Agent
- func (s *Agent) SendStruct(content interface{}) *Agent
- func (s *Agent) Set(param string, value string) *Agent
- func (s *Agent) SetBasicAuth(username string, password string) *Agent
- func (s *Agent) SetCurlCommand(enable bool) *Agent
- func (s *Agent) SetDebug(enable bool) *Agent
- func (s *Agent) SetDoNotClearSuperAgent(enable bool) *Agent
- func (s *Agent) SetLogger(logger Logger) *Agent
- func (s *Agent) TLSClientConfig(config *tls.Config) *Agent
- func (s *Agent) Timeout(timeout time.Duration) *Agent
- func (s *Agent) Type(typeStr string) *Agent
- type File
- type Logger
- type Request
- type Response
Constants ¶
View Source
const ( POST = "POST" GET = "GET" HEAD = "HEAD" PUT = "PUT" DELETE = "DELETE" PATCH = "PATCH" OPTIONS = "OPTIONS" )
HTTP methods we support
View Source
const ( TypeJSON = "json" TypeXML = "xml" TypeUrlencoded = "urlencoded" TypeForm = "form" TypeFormData = "form-data" TypeHTML = "html" TypeText = "text" TypeMultipart = "multipart" )
Types we support.
Variables ¶
View Source
var DisableTransportSwap = false
View Source
var Types = map[string]string{ TypeJSON: "application/json", TypeXML: "application/xml", TypeForm: "application/x-www-form-urlencoded", TypeFormData: "application/x-www-form-urlencoded", TypeUrlencoded: "application/x-www-form-urlencoded", TypeHTML: "text/html", TypeText: "text/plain", TypeMultipart: "multipart/form-data", }
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
Url string
Method string
Header http.Header
TargetType string
ForceType string
Data map[string]interface{}
SliceData []interface{}
FormData url.Values
QueryData url.Values
FileData []File
BounceToRawString bool
RawString string
Client *http.Client
Transport *http.Transport
Cookies []*http.Cookie
Errors []error
BasicAuth struct{ Username, Password string }
Debug bool
CurlCommand bool
Retryable superAgentRetryable
DoNotClearSuperAgent bool
// contains filtered or unexported fields
}
func (*Agent) AsCurlCommand ¶
func (*Agent) ClearSuperAgent ¶
func (s *Agent) ClearSuperAgent()
func (*Agent) CustomMethod ¶
func (*Agent) RedirectPolicy ¶
func (*Agent) SendString ¶
func (*Agent) SendStruct ¶
func (*Agent) SetCurlCommand ¶
func (*Agent) SetDoNotClearSuperAgent ¶
Click to show internal directories.
Click to hide internal directories.
