accept iobody the type is string;
This commit is contained in:
parent
a6217886dc
commit
84ae0a710e
2
base.go
2
base.go
@ -19,6 +19,8 @@ func buildBodyRequest(wf *Workflow) *http.Request {
|
|||||||
switch wf.Body.GetIOBody().(type) {
|
switch wf.Body.GetIOBody().(type) {
|
||||||
case []byte:
|
case []byte:
|
||||||
bodybuf = bytes.NewBuffer(wf.Body.GetIOBody().([]byte))
|
bodybuf = bytes.NewBuffer(wf.Body.GetIOBody().([]byte))
|
||||||
|
case string:
|
||||||
|
bodybuf = bytes.NewBuffer([]byte(wf.Body.GetIOBody().(string)))
|
||||||
case *bytes.Buffer:
|
case *bytes.Buffer:
|
||||||
bodybuf = bytes.NewBuffer(wf.Body.GetIOBody().(*bytes.Buffer).Bytes())
|
bodybuf = bytes.NewBuffer(wf.Body.GetIOBody().(*bytes.Buffer).Bytes())
|
||||||
default:
|
default:
|
||||||
|
28
session.go
28
session.go
@ -307,6 +307,13 @@ func (ses *Session) ClearCookies() {
|
|||||||
ses.client.Jar = ses.cookiejar
|
ses.client.Jar = ses.cookiejar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Head 请求
|
||||||
|
func (ses *Session) Head(url string) *Workflow {
|
||||||
|
wf := NewWorkflow(ses, url)
|
||||||
|
wf.Method = "HEAD"
|
||||||
|
return wf
|
||||||
|
}
|
||||||
|
|
||||||
// Get 请求
|
// Get 请求
|
||||||
func (ses *Session) Get(url string) *Workflow {
|
func (ses *Session) Get(url string) *Workflow {
|
||||||
wf := NewWorkflow(ses, url)
|
wf := NewWorkflow(ses, url)
|
||||||
@ -335,20 +342,6 @@ func (ses *Session) Patch(url string) *Workflow {
|
|||||||
return wf
|
return wf
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete 请求
|
|
||||||
func (ses *Session) Delete(url string) *Workflow {
|
|
||||||
wf := NewWorkflow(ses, url)
|
|
||||||
wf.Method = "DELETE"
|
|
||||||
return wf
|
|
||||||
}
|
|
||||||
|
|
||||||
// Head 请求
|
|
||||||
func (ses *Session) Head(url string) *Workflow {
|
|
||||||
wf := NewWorkflow(ses, url)
|
|
||||||
wf.Method = "HEAD"
|
|
||||||
return wf
|
|
||||||
}
|
|
||||||
|
|
||||||
// Options 请求
|
// Options 请求
|
||||||
func (ses *Session) Options(url string) *Workflow {
|
func (ses *Session) Options(url string) *Workflow {
|
||||||
wf := NewWorkflow(ses, url)
|
wf := NewWorkflow(ses, url)
|
||||||
@ -356,6 +349,13 @@ func (ses *Session) Options(url string) *Workflow {
|
|||||||
return wf
|
return wf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete 请求
|
||||||
|
func (ses *Session) Delete(url string) *Workflow {
|
||||||
|
wf := NewWorkflow(ses, url)
|
||||||
|
wf.Method = "DELETE"
|
||||||
|
return wf
|
||||||
|
}
|
||||||
|
|
||||||
// CloseIdleConnections closes the idle connections that a session client may make use of
|
// CloseIdleConnections closes the idle connections that a session client may make use of
|
||||||
// 从levigross/grequests 借鉴
|
// 从levigross/grequests 借鉴
|
||||||
func (ses *Session) CloseIdleConnections() {
|
func (ses *Session) CloseIdleConnections() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user