Skip to content

Commit 7588564

Browse files
committed
wip
Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
1 parent 255e8d8 commit 7588564

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

openapi3filter/req_resp_decoder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ func TestDecodeParameter(t *testing.T) {
10531053
require.NoError(t, err)
10541054

10551055
input := &RequestValidationInput{Request: req, PathParams: pathParams, Route: route}
1056-
got, found, err := decodeStyledParameter(tc.param, input)
1056+
got, found, err := decodeStyledParameter(tc.param, input, tc.param.Schema)
10571057

10581058
require.Truef(t, found == tc.found, "got found: %t, want found: %t", found, tc.found)
10591059

openapi3filter/validate_request.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,10 @@ func ValidateParameter(ctx context.Context, input *RequestValidationInput, param
139139
err = fmt.Errorf("multiple content types for parameter %q", parameter.Name)
140140
return &RequestError{Input: input, Parameter: parameter, Err: err}
141141
} else {
142-
mt := parameter.Content.Get("application/json")
142+
const ct = "application/json"
143+
mt := parameter.Content.Get(ct)
143144
if mt == nil {
144-
err = fmt.Errorf("parameter %q has no content schema", parameter.Name)
145+
err = fmt.Errorf("parameter %q has no content schema for %q", parameter.Name, ct)
145146
return &RequestError{Input: input, Parameter: parameter, Err: err}
146147
}
147148
schemaRef = mt.Schema

0 commit comments

Comments
 (0)