Пример #1
0
        public async Task Invoke(
            Func <IDictionary <string, object>, Task> func,
            CancellationToken cancellationToken)
        {
            Environment.Environment[OwinEnvironment.Owin.CallCancelled] = cancellationToken;
            await func.Invoke(Environment.Environment).ConfigureAwait(false);

            if (opaqueHandler != null)
            {
                var opaqueEnv = new OpaqueEnvironment(ConnectionStream, cancellationToken);
                await opaqueHandler.Invoke(opaqueEnv.Environment).ConfigureAwait(false);
            }
            else
            {
                await ResponseBody.CompleteAsync(cancellationToken).ConfigureAwait(false);
            }
        }