Пример #1
0
        public void Configure(IApplicationBuilder app, IReplicationService service, ReplicatorTestCase.MockErrorConfig mockErrorConfig)
        {
            // Middleware to throw an exception conditionally from our test server.
            app.Use(async(context, next) =>
            {
                if (mockErrorConfig.RespondWithError)
                {
                    throw new ReplicatorTestCase.HttpResponseException();
                }

                await next();
            });

            app.Run(async(context) =>
            {
                // LUCENENET: This is to allow synchronous IO to happen for these requests.
                // LUCENENET TODO: Allow async operations from Replicator.
                var syncIoFeature = context.Features.Get <IHttpBodyControlFeature>();
                if (syncIoFeature != null)
                {
                    syncIoFeature.AllowSynchronousIO = true;
                }

                await Task.Yield();
                service.Perform(context.Request, context.Response);
            });
        }
Пример #2
0
 public void Configure(IApplicationBuilder app, IHostingEnvironment env, IReplicationService service)
 {
     app.Run(async context =>
     {
         await Task.Yield();
         service.Perform(context.Request, context.Response);
     });
 }
Пример #3
0
        public async Task InvokeAsync(HttpContext context)
        {
            // LUCENENET: This is to allow synchronous IO to happen for these requests.
            // LUCENENET TODO: Allow async operations from Replicator.
            var syncIoFeature = context.Features.Get <IHttpBodyControlFeature>();

            if (syncIoFeature != null)
            {
                syncIoFeature.AllowSynchronousIO = true;
            }

            await Task.Yield();

            service.Perform(context.Request, context.Response);

            // This is a terminating endpoint. Do not call the next delegate/middleware in the pipeline.
        }
 /// <summary>
 /// Extension method that mirrors the signature of <see cref="IReplicationService.Perform"/> using AspNetCore as implementation.
 /// </summary>
 public static void Perform(this IReplicationService self, HttpRequest request, HttpResponse response)
 {
     self.Perform(new AspNetCoreReplicationRequest(request), new AspNetCoreReplicationResponse(response));
 }