-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add gRPC interceptors #232
Conversation
This change introduces proper gRPC interceptors that are avilable regardless of the transport used. Each codegen service now produces an additional method called `with_interceptor` that accepts a `Interceptor`. All examples have been updated to use this new style and interop has a custom `tower::Service` middleware to echo the headers. There is also a new `interceptor` example that shows basic usage.
let inner = tonic::client::Grpc::with_interceptor(inner, interceptor); | ||
Self { inner } | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it would be worth it to use a builder-like pattern instead of whit_interceptor
constructor? Same for the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is only one config option as of now, I wanted to keep this simple, I think if we add another option in the future we go with a builder.
This change introduces proper gRPC interceptors that are avilable
regardless of the transport used. Each codegen service now produces an
additional method called
with_interceptor
that accepts aInterceptor
.All examples have been updated to use this new style and interop has a
custom
tower::Service
middleware to echo the headers. There is also anew
interceptor
example that shows basic usage.