Skip to content

Commit 0cf5a8e

Browse files
committed
protovalidate: evaluate options once
1 parent 62b7de5 commit 0cf5a8e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

interceptors/protovalidate/protovalidate.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func UnaryServerInterceptor(validator *protovalidate.Validator, opts ...Option)
3535
// StreamServerInterceptor returns a new streaming server interceptor that validates incoming messages.
3636
// If the request is invalid, clients may access a structured representation of the validation failure as an error detail.
3737
func StreamServerInterceptor(validator *protovalidate.Validator, opts ...Option) grpc.StreamServerInterceptor {
38+
o := evaluateOpts(opts)
3839
return func(
3940
srv interface{},
4041
stream grpc.ServerStream,
@@ -44,7 +45,7 @@ func StreamServerInterceptor(validator *protovalidate.Validator, opts ...Option)
4445
return handler(srv, &wrappedServerStream{
4546
ServerStream: stream,
4647
validator: validator,
47-
options: evaluateOpts(opts),
48+
options: o,
4849
})
4950
}
5051
}

0 commit comments

Comments
 (0)