Documentation ¶
Index ¶
- Variables
- type Curl
- func (curls *Curl) CreateRequest() (httpRequest *http.Request, err error)
- func (curls *Curl) Request() (rs *Response, err error)
- func (curls *Curl) SetAutoRedirect()
- func (curls *Curl) SetContext(ctx context.Context)
- func (curls *Curl) SetCookies(cookies []*http.Cookie)
- func (curls *Curl) SetHeaders(headers map[string]string)
- func (curls *Curl) SetKeepAlive()
- func (curls *Curl) SetPostBytes(b []byte)
- func (curls *Curl) SetPostField(key, value string)
- func (curls *Curl) SetPostFieldReader(key string, r io.Reader)
- func (curls *Curl) SetPostFile(key, path string)
- func (curls *Curl) SetPostReader(r io.Reader)
- func (curls *Curl) SetPostString(s string)
- func (curls *Curl) SetProxy(proxyURL string)
- func (curls *Curl) SetTimeout(t int)
- func (curls *Curl) SetTimeoutMS(t int)
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRequestTimeout = errors.New("do request time out")
View Source
var ErrStopRedirect = errors.New("not allowed auto redirect")
Functions ¶
This section is empty.
Types ¶
type Curl ¶
type Curl struct { Url string Headers http.Header //流 PostReader io.Reader //[]byte格式 PostBytes []byte //string格式 PostString string //key=>value格式 PostFields neturl.Values PostFieldReaders map[string]io.Reader //文件,key是字段名,val是文件路径 PostFiles neturl.Values // contains filtered or unexported fields }
func (*Curl) CreateRequest ¶
func (*Curl) SetAutoRedirect ¶
func (curls *Curl) SetAutoRedirect()
func (*Curl) SetContext ¶
func (*Curl) SetCookies ¶
func (*Curl) SetHeaders ¶
func (*Curl) SetKeepAlive ¶
func (curls *Curl) SetKeepAlive()
func (*Curl) SetPostField ¶
以key=>value方式,以下三个都是key=>value方式,可以共同使用
func (*Curl) SetPostFieldReader ¶
以流的方式
Click to show internal directories.
Click to hide internal directories.