Exemple #1
0
        /// <inheritdoc />
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request,
                                                                      CancellationToken cancellationToken)
        {
            var ctx = new CompabilityInvocationContext(request, cancellationToken);

            await InvokeAsync(ctx);

            return(ctx.ResponseMessage);
        }
Exemple #2
0
        /// <summary>
        /// Call the next delegate in the chain.
        /// </summary>
        /// <param name="context">The compatible delegate context.</param>
        protected virtual async Task CallNextDelegateAsync(CompabilityInvocationContext context)
        {
#if NETCOREAPP
            await _next(context.Context);
#else
            var response = await base.SendAsync(context.RequestMessage, context.CancellationToken);

            context.ResponseMessage = response;
#endif
        }
Exemple #3
0
 /// <summary>
 /// This is where the compatible invocation takes place.
 /// </summary>
 /// <param name="context">The compatible delegate context.</param>
 protected abstract Task InvokeAsync(CompabilityInvocationContext context);
Exemple #4
0
        public virtual async Task InvokeAsync(HttpContext context)
        {
            var ctx = new CompabilityInvocationContext(context);

            await InvokeAsync(ctx);
        }
 /// <summary>
 /// This is where the compatible invocation takes place.
 /// </summary>
 /// <param name="context">The compatible delegate context.</param>
 /// <param name="cancellationToken">Token for cancellation</param>
 protected abstract Task InvokeAsync(CompabilityInvocationContext context, CancellationToken cancellationToken);