IOBODY -> GETIOBODY
This commit is contained in:
parent
8a6e29bc8a
commit
9d6dee25c9
10
base.go
10
base.go
|
@ -12,17 +12,17 @@ func buildBodyRequest(wf *Workflow) *http.Request {
|
||||||
var err error
|
var err error
|
||||||
contentType := ""
|
contentType := ""
|
||||||
|
|
||||||
if wf.Body.IOBody() == nil {
|
if wf.Body.GetIOBody() == nil {
|
||||||
req, err = http.NewRequest(wf.Method, wf.GetRawURL(), nil)
|
req, err = http.NewRequest(wf.Method, wf.GetRawURL(), nil)
|
||||||
} else {
|
} else {
|
||||||
var bodybuf *bytes.Buffer
|
var bodybuf *bytes.Buffer
|
||||||
switch wf.Body.IOBody().(type) {
|
switch wf.Body.GetIOBody().(type) {
|
||||||
case []byte:
|
case []byte:
|
||||||
bodybuf = bytes.NewBuffer(wf.Body.IOBody().([]byte))
|
bodybuf = bytes.NewBuffer(wf.Body.GetIOBody().([]byte))
|
||||||
case *bytes.Buffer:
|
case *bytes.Buffer:
|
||||||
bodybuf = bytes.NewBuffer(wf.Body.IOBody().(*bytes.Buffer).Bytes())
|
bodybuf = bytes.NewBuffer(wf.Body.GetIOBody().(*bytes.Buffer).Bytes())
|
||||||
default:
|
default:
|
||||||
panic(errors.New("the type is not exist, type is" + reflect.TypeOf(wf.Body.IOBody).String()))
|
panic(errors.New("the type is not exist, type is" + reflect.TypeOf(wf.Body.GetIOBody()).String()))
|
||||||
}
|
}
|
||||||
req, err = http.NewRequest(wf.Method, wf.GetRawURL(), bodybuf)
|
req, err = http.NewRequest(wf.Method, wf.GetRawURL(), bodybuf)
|
||||||
}
|
}
|
||||||
|
|
15
session.go
15
session.go
|
@ -36,8 +36,8 @@ func (body *Body) SetIOBody(iobody interface{}) {
|
||||||
body.ioBody = iobody
|
body.ioBody = iobody
|
||||||
}
|
}
|
||||||
|
|
||||||
// IOBody 获取ioBody值
|
// GetIOBody 获取ioBody值
|
||||||
func (body *Body) IOBody() interface{} {
|
func (body *Body) GetIOBody() interface{} {
|
||||||
return body.ioBody
|
return body.ioBody
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,16 +70,15 @@ func (body *Body) AddContentType(ct string) {
|
||||||
|
|
||||||
// IBody 相关参数结构
|
// IBody 相关参数结构
|
||||||
type IBody interface {
|
type IBody interface {
|
||||||
|
// GetIOBody 获取iobody data
|
||||||
// Query map[string][]string
|
GetIOBody() interface{}
|
||||||
IOBody() interface{}
|
// SetIOBody 设置iobody data
|
||||||
// SetIOBody
|
|
||||||
SetIOBody(iobody interface{})
|
SetIOBody(iobody interface{})
|
||||||
// Files []UploadFile
|
// ContentType 返回包括 Prefix 所有的ContentType
|
||||||
ContentType() string
|
ContentType() string
|
||||||
// AppendContent
|
// AppendContent
|
||||||
AddContentType(ct string)
|
AddContentType(ct string)
|
||||||
// AddPrefix 添加 Prefix
|
// SetPrefix 设置 Prefix; 唯一前缀
|
||||||
SetPrefix(ct string)
|
SetPrefix(ct string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user