grpc-dart
grpc-dart copied to clipboard
[Feature Request] server-side "wrapper" interceptors
Hello, I'd like to see something like Interceptors on the server side, but more akin to the UnaryInterceptor of gRPC-Web. This is something I have appreciated from other server frameworks. This style of interceptor would "wrap" around the service call, which yields the existing functionality of Interceptors (such as vetoing a request) and more. Such "wrapping" interceptors would be able to manipulate both the incoming request as well as the outgoing response.
There are several interesting use cases for this. One such use case would be instrumenting all service calls in a uniform way.
Interceptor 1
| Interceptor 2
| | Interceptor 3
| | | service call
| | Interceptor 3
| Interceptor 2
Interceptor 1
I think it makes sense to deprecate current interceptor functionality and align client and server interceptor APIs. Feel free to contribute PR with the implementation.
Note to self, consider addressing #546 when implementing this.
A server-side interceptor could possibly add CORS headers to a response, fixing #611