Skip to content

Commit

Permalink
getkin#709 - check for error returned from SerializationMethod error
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Lessard committed Dec 17, 2022
1 parent 2fbce80 commit 60c552e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion openapi3filter/validate_response.go
Expand Up @@ -161,8 +161,16 @@ func validateResponseHeader(headerName string, headerRef *openapi3.HeaderRef, in
var err error
var decodedValue interface{}
var found bool
var sm *openapi3.SerializationMethod
dec := &headerParamDecoder{header: input.Header}
sm, _ := headerRef.Value.SerializationMethod() // ignore error return because a header's serialization method getter does not return an error

if sm, err = headerRef.Value.SerializationMethod(); err != nil {
return &ResponseError{
Input: input,
Reason: fmt.Sprintf("unable to get header %q serialization method", headerName),
Err: err,
}
}

if decodedValue, found, err = decodeValue(dec, headerName, sm, headerRef.Value.Schema, headerRef.Value.Required); err != nil {
return &ResponseError{
Expand Down

0 comments on commit 60c552e

Please sign in to comment.