diff --git a/base.go b/base.go index eb90eb8..cfe3e5d 100644 --- a/base.go +++ b/base.go @@ -12,17 +12,17 @@ func buildBodyRequest(wf *Workflow) *http.Request { var err error contentType := "" - if wf.Body.IOBody() == nil { + if wf.Body.GetIOBody() == nil { req, err = http.NewRequest(wf.Method, wf.GetRawURL(), nil) } else { var bodybuf *bytes.Buffer - switch wf.Body.IOBody().(type) { + switch wf.Body.GetIOBody().(type) { case []byte: - bodybuf = bytes.NewBuffer(wf.Body.IOBody().([]byte)) + bodybuf = bytes.NewBuffer(wf.Body.GetIOBody().([]byte)) case *bytes.Buffer: - bodybuf = bytes.NewBuffer(wf.Body.IOBody().(*bytes.Buffer).Bytes()) + bodybuf = bytes.NewBuffer(wf.Body.GetIOBody().(*bytes.Buffer).Bytes()) 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) } diff --git a/session.go b/session.go index 8b5e0ed..93126d6 100644 --- a/session.go +++ b/session.go @@ -36,8 +36,8 @@ func (body *Body) SetIOBody(iobody interface{}) { body.ioBody = iobody } -// IOBody 获取ioBody值 -func (body *Body) IOBody() interface{} { +// GetIOBody 获取ioBody值 +func (body *Body) GetIOBody() interface{} { return body.ioBody } @@ -70,16 +70,15 @@ func (body *Body) AddContentType(ct string) { // IBody 相关参数结构 type IBody interface { - - // Query map[string][]string - IOBody() interface{} - // SetIOBody + // GetIOBody 获取iobody data + GetIOBody() interface{} + // SetIOBody 设置iobody data SetIOBody(iobody interface{}) - // Files []UploadFile + // ContentType 返回包括 Prefix 所有的ContentType ContentType() string // AppendContent AddContentType(ct string) - // AddPrefix 添加 Prefix + // SetPrefix 设置 Prefix; 唯一前缀 SetPrefix(ct string) }