2 Commits

Author SHA1 Message Date
huangsimin
3ee03a1c7b 修复上个tag的上传错误
v0.0.8
2018-10-23 17:39:11 +08:00
huangsimin
a68be94c7f 添加BasicAuth 验证信息 2018-10-23 17:35:40 +08:00
2 changed files with 12 additions and 2 deletions

View File

@@ -246,3 +246,9 @@ func (ses *Session) Options(url string) *Workflow {
wf.SetURL(url)
return wf
}
// CloseIdleConnections closes the idle connections that a session client may make use of
// 从levigross/grequests 借鉴
func (ses *Session) CloseIdleConnections() {
ses.client.Transport.(*http.Transport).CloseIdleConnections()
}

View File

@@ -147,13 +147,13 @@ func (wf *Workflow) SetURLPath(path []string) *Workflow {
return wf
}
// SetURLRawPath 设置Path参数
// SetURLRawPath 设置Pa晚上参数
func (wf *Workflow) SetURLRawPath(path string) *Workflow {
wf.ParsedURL.Path = path
return wf
}
// SetBodyParams 参数设
// SetBodyParams 参数设晚上
func (wf *Workflow) SetBodyParams(params ...interface{}) *Workflow {
if params == nil {
return wf
@@ -243,6 +243,10 @@ func (wf *Workflow) Execute() (*Response, error) {
setHeaderRequest(req, wf)
setTempCookieRequest(req, wf)
if wf.session.auth != nil {
req.SetBasicAuth(wf.session.auth.User, wf.session.auth.Password)
}
resp, err := wf.session.client.Do(req)
if err != nil {
return nil, err