/// <inheritdoc /> protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var ctx = new CompabilityInvocationContext(request, cancellationToken); await InvokeAsync(ctx); return(ctx.ResponseMessage); }
/// <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 }
/// <summary> /// This is where the compatible invocation takes place. /// </summary> /// <param name="context">The compatible delegate context.</param> protected abstract Task InvokeAsync(CompabilityInvocationContext context);
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);