|
|
|
@ -132,6 +132,13 @@ namespace Grpc.Core.Interceptors |
|
|
|
|
/// and returns a <see cref="Grpc.Core.Metadata" /> instance that will replace the existing |
|
|
|
|
/// invocation metadata. |
|
|
|
|
/// </param> |
|
|
|
|
/// <remarks> |
|
|
|
|
/// Multiple interceptors can be added on top of each other by calling |
|
|
|
|
/// "invoker.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". |
|
|
|
|
/// Interceptors can be later added to an existing intercepted CallInvoker, effectively |
|
|
|
|
/// building a chain like "invoker.Intercept(c).Intercept(b).Intercept(a)". Note that |
|
|
|
|
/// in this case, the last interceptor added will be the first to take control. |
|
|
|
|
/// </remarks> |
|
|
|
|
public static CallInvoker Intercept(this CallInvoker invoker, Func<Metadata, Metadata> interceptor) |
|
|
|
|
{ |
|
|
|
|
return new InterceptingCallInvoker(invoker, new MetadataInterceptor(interceptor)); |
|
|
|
@ -143,6 +150,13 @@ namespace Grpc.Core.Interceptors |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="invoker">The underlying invoker to intercept.</param> |
|
|
|
|
/// <param name="interceptor">The interceptor to intercept calls to the invoker with.</param> |
|
|
|
|
/// <remarks> |
|
|
|
|
/// Multiple interceptors can be added on top of each other by calling |
|
|
|
|
/// "invoker.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". |
|
|
|
|
/// Interceptors can be later added to an existing intercepted CallInvoker, effectively |
|
|
|
|
/// building a chain like "invoker.Intercept(c).Intercept(b).Intercept(a)". Note that |
|
|
|
|
/// in this case, the last interceptor added will be the first to take control. |
|
|
|
|
/// </remarks> |
|
|
|
|
public static CallInvoker Intercept(this CallInvoker invoker, Interceptor interceptor) |
|
|
|
|
{ |
|
|
|
|
return new InterceptingCallInvoker(invoker, interceptor); |
|
|
|
@ -157,6 +171,13 @@ namespace Grpc.Core.Interceptors |
|
|
|
|
/// An array of interceptors to intercept the calls to the invoker with. |
|
|
|
|
/// Control is passed to the interceptors in the order specified. |
|
|
|
|
/// </param> |
|
|
|
|
/// <remarks> |
|
|
|
|
/// Multiple interceptors can be added on top of each other by calling |
|
|
|
|
/// "invoker.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". |
|
|
|
|
/// Interceptors can be later added to an existing intercepted CallInvoker, effectively |
|
|
|
|
/// building a chain like "invoker.Intercept(c).Intercept(b).Intercept(a)". Note that |
|
|
|
|
/// in this case, the last interceptor added will be the first to take control. |
|
|
|
|
/// </remarks> |
|
|
|
|
public static CallInvoker Intercept(this CallInvoker invoker, params Interceptor[] interceptors) |
|
|
|
|
{ |
|
|
|
|
GrpcPreconditions.CheckNotNull(invoker, "invoker"); |
|
|
|
|