Skip to content

Commit

Permalink
Merge pull request #1170 from sashamelentyev/handle-cookie-err
Browse files Browse the repository at this point in the history
chore: handle cookie error
  • Loading branch information
tdakkota authored Jan 31, 2024
2 parents 092ca33 + 58dd6b1 commit d5fceb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions gen/_template/security.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ func (s *Server) security{{ $s.Type.Name }}(ctx context.Context, operationName s
value := q.Get(parameterName)
{{- else if $s.Kind.IsCookie }}
var value string
switch cookie, err := req.Cookie(parameterName); err {
case nil:
switch cookie, err := req.Cookie(parameterName); {
case err == nil: // if NO error
value = cookie.Value
case http.ErrNoCookie:
case errors.Is(err, http.ErrNoCookie):
return ctx, false, nil
default:
return nil, false, err
return nil, false, errors.Wrap(err, "get cookie value")
}
{{- else }}
{{ errorf "unexpected security %q:%q" $s.Kind $s.Format }}
Expand Down
8 changes: 4 additions & 4 deletions internal/integration/test_security/oas_security_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d5fceb0

Please sign in to comment.