Skip to content

Commit

Permalink
Fixes #246
Browse files Browse the repository at this point in the history
Signed-off-by: Makarand <[email protected]>
  • Loading branch information
MakarandNsd committed Jun 14, 2022
1 parent 3f9800f commit 930a130
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion middleware/parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ func (p *untypedParamBinder) Bind(request *http.Request, routeParams RouteParams
if p.parameter.Type == "file" {
file, header, ffErr := request.FormFile(p.parameter.Name)
if ffErr != nil {
return errors.NewParseError(p.Name, p.parameter.In, "", ffErr)
if p.parameter.Required {
return errors.NewParseError(p.Name, p.parameter.In, "", ffErr)
} else {
return nil
}
}
target.Set(reflect.ValueOf(runtime.File{Data: file, Header: header}))
return nil
Expand Down

0 comments on commit 930a130

Please sign in to comment.