Skip to content

Commit

Permalink
protovalidate: evaluate options once
Browse files Browse the repository at this point in the history
  • Loading branch information
ash2k committed Aug 16, 2024
1 parent 62b7de5 commit 0cf5a8e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion interceptors/protovalidate/protovalidate.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func UnaryServerInterceptor(validator *protovalidate.Validator, opts ...Option)
// StreamServerInterceptor returns a new streaming server interceptor that validates incoming messages.
// If the request is invalid, clients may access a structured representation of the validation failure as an error detail.
func StreamServerInterceptor(validator *protovalidate.Validator, opts ...Option) grpc.StreamServerInterceptor {
o := evaluateOpts(opts)
return func(
srv interface{},
stream grpc.ServerStream,
Expand All @@ -44,7 +45,7 @@ func StreamServerInterceptor(validator *protovalidate.Validator, opts ...Option)
return handler(srv, &wrappedServerStream{
ServerStream: stream,
validator: validator,
options: evaluateOpts(opts),
options: o,
})
}
}
Expand Down

0 comments on commit 0cf5a8e

Please sign in to comment.