File tree Expand file tree Collapse file tree 2 files changed +32
-33
lines changed Expand file tree Collapse file tree 2 files changed +32
-33
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -51,5 +51,37 @@ public static THttpApi Create<THttpApi>(IActionInterceptor actionInterceptor)
5151 {
5252 return HttpApiProxyBuilder < THttpApi > . Build ( actionInterceptor ) ;
5353 }
54+
55+
56+ /// <summary>
57+ /// 表示httpApi方法调用的拦截器
58+ /// </summary>
59+ private class ActionInterceptor : IActionInterceptor
60+ {
61+ /// <summary>
62+ /// 服务上下文
63+ /// </summary>
64+ private readonly HttpClientContext context ;
65+
66+ /// <summary>
67+ /// httpApi方法调用的拦截器
68+ /// </summary>
69+ /// <param name="context">服务上下文</param>
70+ public ActionInterceptor ( HttpClientContext context )
71+ {
72+ this . context = context ;
73+ }
74+
75+ /// <summary>
76+ /// 拦截方法的调用
77+ /// </summary>
78+ /// <param name="actionInvoker">action执行器</param>
79+ /// <param name="arguments">方法的参数集合</param>
80+ /// <returns></returns>
81+ public object Intercept ( IActionInvoker actionInvoker , object ? [ ] arguments )
82+ {
83+ return actionInvoker . Invoke ( this . context , arguments ) ;
84+ }
85+ }
5486 }
5587}
You can’t perform that action at this time.
0 commit comments