get data from multipart components
This commit is contained in:
parent
dc34d9a81a
commit
7b812c6648
|
@ -232,7 +232,7 @@ func (i *Set) parseMultipart(req *http.Request) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, param := range i.service.Form {
|
for name, param := range i.service.Form {
|
||||||
value, exist := mpr.Data[name]
|
component, exist := mpr.Data[name]
|
||||||
|
|
||||||
// fail on missing required
|
// fail on missing required
|
||||||
if !exist && !param.Optional {
|
if !exist && !param.Optional {
|
||||||
|
@ -245,7 +245,7 @@ func (i *Set) parseMultipart(req *http.Request) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fail on invalid type
|
// fail on invalid type
|
||||||
cast, valid := param.Validator(value)
|
cast, valid := param.Validator(string(component.Data))
|
||||||
if !valid {
|
if !valid {
|
||||||
return fmt.Errorf("%s: %w", name, ErrInvalidType)
|
return fmt.Errorf("%s: %w", name, ErrInvalidType)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue