Skip to content
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

Merged
merged 4 commits into from
Jan 14, 2020
Merged

feat: Add gRPC interceptors #232

merged 4 commits into from
Jan 14, 2020

Conversation

LucioFranco
Copy link
Member

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.

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.
@LucioFranco LucioFranco requested a review from alce January 14, 2020 00:42
@LucioFranco LucioFranco changed the title featL Add gRPC interceptors feat: Add gRPC interceptors Jan 14, 2020
examples/Cargo.toml Outdated Show resolved Hide resolved
let inner = tonic::client::Grpc::with_interceptor(inner, interceptor);
Self { inner }
}

Copy link
Collaborator

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.

Copy link
Member Author

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.

@LucioFranco LucioFranco merged commit eba7ec7 into master Jan 14, 2020
@LucioFranco LucioFranco deleted the lucio/new-interceptors branch January 14, 2020 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants