mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 16:58:27 +02:00
#endif
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
//#if USE_ASPNETCORE && !NETSTANDARD1_3
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
@@ -116,5 +115,4 @@ internal static class IWebHostBuilderExtensions
|
||||
services.Configure<KestrelServerOptions>(context.Configuration.GetSection("Kestrel"));
|
||||
});
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
//#if USE_ASPNETCORE
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -96,10 +95,6 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost
|
||||
SetHttpsAndUrls(options, _wireMockMiddlewareOptions, _urlOptions.GetDetails());
|
||||
})
|
||||
.ConfigureKestrelServerOptions()
|
||||
|
||||
//#if NETSTANDARD1_3
|
||||
// .UseUrls(_urlOptions.GetDetails().Select(u => u.Url).ToArray())
|
||||
//#endif
|
||||
.Build();
|
||||
|
||||
return RunHost(_cts.Token);
|
||||
@@ -137,14 +132,7 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost
|
||||
_logger.Info("Server using .NET Framework 4.8");
|
||||
#endif
|
||||
|
||||
//#if NETSTANDARD1_3
|
||||
// return Task.Run(() =>
|
||||
// {
|
||||
// _host.Run(token);
|
||||
// });
|
||||
//#else
|
||||
return _host.RunAsync(token);
|
||||
//#endif
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -162,11 +150,6 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost
|
||||
_cts.Cancel();
|
||||
|
||||
IsStarted = false;
|
||||
//#if NETSTANDARD1_3
|
||||
// return Task.CompletedTask;
|
||||
//#else
|
||||
return _host.StopAsync();
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
@@ -6,49 +6,24 @@ using Newtonsoft.Json;
|
||||
using WireMock.Owin.Mappers;
|
||||
using Stef.Validation;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
//#if !USE_ASPNETCORE
|
||||
//using Microsoft.Owin;
|
||||
//using IContext = Microsoft.Owin.IOwinContext;
|
||||
//using OwinMiddleware = Microsoft.Owin.OwinMiddleware;
|
||||
//using Next = Microsoft.Owin.OwinMiddleware;
|
||||
//#else
|
||||
//using OwinMiddleware = System.Object;
|
||||
//using IContext = Microsoft.AspNetCore.Http.HttpContext;
|
||||
//using Next = Microsoft.AspNetCore.Http.RequestDelegate;
|
||||
//#endif
|
||||
|
||||
|
||||
namespace WireMock.Owin;
|
||||
|
||||
internal class GlobalExceptionMiddleware //: OwinMiddleware
|
||||
internal class GlobalExceptionMiddleware
|
||||
{
|
||||
private readonly IWireMockMiddlewareOptions _options;
|
||||
private readonly IOwinResponseMapper _responseMapper;
|
||||
|
||||
//#if !USE_ASPNETCORE
|
||||
// public GlobalExceptionMiddleware(Next next, IWireMockMiddlewareOptions options, IOwinResponseMapper responseMapper) : base(next)
|
||||
// {
|
||||
// _options = Guard.NotNull(options);
|
||||
// _responseMapper = Guard.NotNull(responseMapper);;
|
||||
// }
|
||||
//#else
|
||||
public GlobalExceptionMiddleware(RequestDelegate next, IWireMockMiddlewareOptions options, IOwinResponseMapper responseMapper)
|
||||
{
|
||||
Next = next;
|
||||
_options = Guard.NotNull(options);
|
||||
_responseMapper = Guard.NotNull(responseMapper);
|
||||
}
|
||||
//#endif
|
||||
|
||||
//#if USE_ASPNETCORE
|
||||
public RequestDelegate? Next { get; }
|
||||
//#endif
|
||||
|
||||
//#if !USE_ASPNETCORE
|
||||
// public override Task Invoke(IContext ctx)
|
||||
//#else
|
||||
public Task Invoke(HttpContext ctx)
|
||||
//#endif
|
||||
{
|
||||
return InvokeInternalAsync(ctx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user