mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-20 16:23:42 +01:00
Fix listen on AnyIP for url 0.0.0.0 (#1165)
* fix listen to AnyIP if url is 0.0.0.0 * Add Test for listenin on AnyIP for url 0.0.0.0 * add missing using, use var, indent, remove empty line * remove assert for ipv4/v6 address list * test only if NET6_0_OR_GREATER * use same code style * add missing + * Asser. to Assert * split single test into one for IPv4 and one for IPv6 * Create IgnoreOnContinuousIntegrationFact.cs * Ignore tests if CI/CD * change to file - scoped namespace and add GITHUB_ACTIONS * use PortUtils.FindFreeTcpPort() * add and use GetIPAddressesByFamily * add using System.Net.Sockets * use #if for both unit tests and include new helper method inside
This commit is contained in:
@@ -75,8 +75,15 @@ namespace WireMock.Owin
|
||||
|
||||
private static void Listen(KestrelServerOptions kestrelOptions, HostUrlDetails urlDetail, Action<ListenOptions> configure)
|
||||
{
|
||||
// Listens on any IP with the given port.
|
||||
if (urlDetail is { Port: > 0, Host: "0.0.0.0" })
|
||||
{
|
||||
kestrelOptions.ListenAnyIP(urlDetail.Port, configure);
|
||||
return;
|
||||
}
|
||||
|
||||
// Listens on ::1 and 127.0.0.1 with the given port.
|
||||
if (urlDetail is { Port: > 0, Host: "localhost" or "127.0.0.1" or "0.0.0.0" or "::1" })
|
||||
if (urlDetail is { Port: > 0, Host: "localhost" or "127.0.0.1" or "::1" })
|
||||
{
|
||||
kestrelOptions.ListenLocalhost(urlDetail.Port, configure);
|
||||
return;
|
||||
@@ -113,4 +120,4 @@ namespace WireMock.Owin
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user