Skip to content

Commit

Permalink
fix multipart last part boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
northseadl committed Jan 7, 2023
1 parent d56b3ad commit bf9353d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions http/contract/dataflowInterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type MultipartDfInterface interface {
Part(header textproto.MIMEHeader, reader io.Reader) MultipartDfInterface
FieldValue(fieldName string, value string) MultipartDfInterface
Field(fieldName string, reader io.Reader) MultipartDfInterface
Close() error
GetBoundary() string
GetReader() io.Reader
GetContentType() string
Expand Down
7 changes: 6 additions & 1 deletion http/dataflow/dataflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,12 @@ func (d *Dataflow) Xml(xmlAny interface{}) contract.RequestDataflowInterface {
func (d *Dataflow) Multipart(multipartDf func(multipart contract.MultipartDfInterface)) contract.RequestDataflowInterface {
multipart := NewMultipartHelper()
multipartDf(multipart)
err := multipart.Err()
err := multipart.Close()
if err != nil {
d.err = append(d.err, err)
return d
}
err = multipart.Err()
if err != nil {
d.err = append(d.err, err)
return d
Expand Down
4 changes: 4 additions & 0 deletions http/dataflow/mutlipart.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ func (m *MultipartDf) Field(fieldName string, reader io.Reader) contract.Multipa
return m
}

func (m *MultipartDf) Close() error {
return m.mWriter.Close()
}

func (m *MultipartDf) GetBoundary() string {
return m.mWriter.Boundary()
}
Expand Down

0 comments on commit bf9353d

Please sign in to comment.