aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs
diff options
context:
space:
mode:
authorGravatar Mehrdad Afshari <mmx@google.com>2018-02-11 23:29:51 -0800
committerGravatar Mehrdad Afshari <mmx@google.com>2018-02-21 18:30:19 -0800
commit2354a1d76eecef541083f674a6c21592556ac54a (patch)
tree9ce09446db6864e7281f0e6f1dbdbb8469348b10 /src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs
parent4bc49f5c4b9b22c2d90e1933d3223799755c1e81 (diff)
Add Intercept(metadata=>metadata) helper function
Diffstat (limited to 'src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs')
-rw-r--r--src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs b/src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs
index 1a54b93dae..25d1724803 100644
--- a/src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs
+++ b/src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs
@@ -50,5 +50,20 @@ namespace Grpc.Core.Interceptors
{
return new DefaultCallInvoker(channel).Intercept(interceptors);
}
+
+ /// <summary>
+ /// Returns a <see cref="Grpc.Core.CallInvoker" /> instance that intercepts
+ /// the invoker with the given interceptor.
+ /// </summary>
+ /// <param name="channel">The channel to intercept.</param>
+ /// <param name="interceptor">
+ /// An interceptor delegate that takes the request metadata to be sent with an outgoing call
+ /// and returns a <see cref="Grpc.Core.Metadata" /> instance that will replace the existing
+ /// invocation metadata.
+ /// </param>
+ public static CallInvoker Intercept(this Channel channel, Func<Metadata, Metadata> interceptor)
+ {
+ return new DefaultCallInvoker(channel).Intercept(interceptor);
+ }
}
}