2018-05-29 13:42:41 +00:00
|
|
|
package multipart
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bufio"
|
|
|
|
)
|
|
|
|
|
2018-07-08 23:34:21 +00:00
|
|
|
// Reader represents a multipart reader
|
|
|
|
type Reader struct {
|
2018-05-29 13:42:41 +00:00
|
|
|
// reader used for http.Request.Body reading
|
|
|
|
reader *bufio.Reader
|
|
|
|
|
|
|
|
// boundary used to separate multipart components
|
|
|
|
boundary string
|
|
|
|
|
|
|
|
// result will be inside this field
|
2018-07-08 23:34:21 +00:00
|
|
|
Components map[string]*Component
|
2018-05-29 13:42:41 +00:00
|
|
|
}
|
|
|
|
|
2018-07-08 23:34:21 +00:00
|
|
|
// Component represents a multipart component
|
|
|
|
type Component struct {
|
2018-05-29 13:42:41 +00:00
|
|
|
// whether this component is a file
|
|
|
|
// if not, it is a simple variable data
|
|
|
|
File bool
|
|
|
|
|
|
|
|
// actual data
|
|
|
|
Data []string
|
|
|
|
}
|