2018-05-29 13:42:41 +00:00
|
|
|
package multipart
|
|
|
|
|
2020-03-21 13:19:14 +00:00
|
|
|
// cerr allows you to create constant "const" error with type boxing.
|
|
|
|
type cerr string
|
2020-03-16 11:53:48 +00:00
|
|
|
|
2020-03-21 13:19:14 +00:00
|
|
|
func (err cerr) Error() string {
|
2020-03-16 11:53:48 +00:00
|
|
|
return string(err)
|
|
|
|
}
|
2019-05-01 16:01:32 +00:00
|
|
|
|
2020-04-04 10:43:55 +00:00
|
|
|
// errMissingDataName is set when a multipart variable/file has no name="..."
|
|
|
|
const errMissingDataName = cerr("data has no name")
|
2018-09-25 19:22:25 +00:00
|
|
|
|
2020-04-04 10:43:55 +00:00
|
|
|
// errDataNameConflict is set when a multipart variable/file name is already used
|
|
|
|
const errDataNameConflict = cerr("data name conflict")
|
2018-09-25 19:22:25 +00:00
|
|
|
|
2020-04-04 10:43:55 +00:00
|
|
|
// errNoHeader is set when a multipart variable/file has no (valid) header
|
|
|
|
const errNoHeader = cerr("data has no header")
|
2018-09-25 19:22:25 +00:00
|
|
|
|
|
|
|
// Component represents a multipart variable/file
|
|
|
|
type Component struct {
|
|
|
|
// Content Type (raw for variables ; exported from files)
|
|
|
|
ContentType string
|
|
|
|
|
|
|
|
// data headers
|
|
|
|
Headers map[string]string
|
|
|
|
|
|
|
|
// actual data
|
|
|
|
Data []byte
|
|
|
|
}
|