mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 00:38:28 +02:00
Add option to run the server on http & https (#818)
* HostingProtocol.HttpAndHttps * . * . * . * HostingScheme
This commit is contained in:
@@ -21,6 +21,7 @@ using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseProviders;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Types;
|
||||
|
||||
namespace WireMock.Server;
|
||||
|
||||
@@ -48,7 +49,7 @@ public partial class WireMockServer : IWireMockServer
|
||||
|
||||
/// <inheritdoc />
|
||||
[PublicAPI]
|
||||
public int Port => Ports?.FirstOrDefault() ?? default(int);
|
||||
public int Port => Ports?.FirstOrDefault() ?? default;
|
||||
|
||||
/// <inheritdoc />
|
||||
[PublicAPI]
|
||||
@@ -269,11 +270,22 @@ public partial class WireMockServer : IWireMockServer
|
||||
}
|
||||
else
|
||||
{
|
||||
urlOptions = new HostUrlOptions
|
||||
if (settings.HostingScheme is not null)
|
||||
{
|
||||
UseSSL = settings.UseSSL == true,
|
||||
Port = settings.Port
|
||||
};
|
||||
urlOptions = new HostUrlOptions
|
||||
{
|
||||
HostingScheme = settings.HostingScheme.Value,
|
||||
Port = settings.Port
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
urlOptions = new HostUrlOptions
|
||||
{
|
||||
HostingScheme = settings.UseSSL == true ? HostingScheme.Https : HostingScheme.Http,
|
||||
Port = settings.Port
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
_options.FileSystemHandler = _settings.FileSystemHandler;
|
||||
|
||||
Reference in New Issue
Block a user