Beispiel #1
0
 public override void Apply(RequestParametersTransformContext context)
 {
     if (FromMethod.Equals(context.ProxyRequest.Method))
     {
         context.ProxyRequest.Method = ToMethod;
     }
 }
Beispiel #2
0
        /// <inheritdoc/>
        public override ValueTask ApplyAsync(RequestTransformContext context)
        {
            if (FromMethod.Equals(context.ProxyRequest.Method))
            {
                context.ProxyRequest.Method = ToMethod;
            }

            return(default);
        public override Task ApplyAsync(RequestTransformContext context)
        {
            if (FromMethod.Equals(context.ProxyRequest.Method))
            {
                context.ProxyRequest.Method = ToMethod;
            }

            return(Task.CompletedTask);
        }
        public new T Call <T>(object instance, params object[] args) where T : class
        {
            Remove();
            try
            {
                var ret = FromMethod.Invoke(instance, args) as T;
                ReApply();
                return(ret);
            }
            catch (Exception)
            {
                // TODO: On Hook failure, raise an event, or called a logger.
            }

            ReApply();
            return(default(T));
        }