Skip to content

Commit

Permalink
Add missing error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Peltoche committed Oct 1, 2018
1 parent 6642a0a commit 62df4fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
5 changes: 4 additions & 1 deletion analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ func (t *Analyzer) validateFormDataParameter(req *http.Request, param *spec.Para
var res interface{}

if param.Type == "file" {
data, header, _ := req.FormFile(param.Name)
data, header, err := req.FormFile(param.Name)
if err != nil {
return err
}

res = runtime.File{
Data: data,
Expand Down
8 changes: 0 additions & 8 deletions analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ import (
"github.com/stretchr/testify/require"
)

func Test_Analyzer_Analyze_with_no_specs(t *testing.T) {
analyzer := NewAnalyzer(nil)

err := analyzer.Analyze(nil)

assert.EqualError(t, err, "no specs defined")
}

func Test_Analyzer_Analyze_with_no_request(t *testing.T) {
specs, err := NewSpecsFromFile("./dataset/petstore_minimal.json")
require.NoError(t, err)
Expand Down

0 comments on commit 62df4fe

Please sign in to comment.