diff --git a/consumer/src/main/kotlin/au/com/dius/pact/consumer/KTorMockServer.kt b/consumer/src/main/kotlin/au/com/dius/pact/consumer/KTorMockServer.kt index 9df468979..f7118c852 100644 --- a/consumer/src/main/kotlin/au/com/dius/pact/consumer/KTorMockServer.kt +++ b/consumer/src/main/kotlin/au/com/dius/pact/consumer/KTorMockServer.kt @@ -124,7 +124,13 @@ class KTorMockServer @JvmOverloads constructor( override fun getUrl(): String { val address = socketAddress() return if (address != null) { - "${config.scheme}://${address.hostname}:${address.port}" + // Stupid GitHub Windows agents + val host = if (address.hostname.lowercase() == "miningmadness.com") { + config.hostname + } else { + address.hostname + } + "${config.scheme}://$host:${address.port}" } else { val connectorConfig = server.environment.connectors.first() "${config.scheme}://${connectorConfig.host}:${connectorConfig.port}" diff --git a/consumer/src/main/kotlin/au/com/dius/pact/consumer/MockHttpServer.kt b/consumer/src/main/kotlin/au/com/dius/pact/consumer/MockHttpServer.kt index 13c5e4908..d0f56806f 100755 --- a/consumer/src/main/kotlin/au/com/dius/pact/consumer/MockHttpServer.kt +++ b/consumer/src/main/kotlin/au/com/dius/pact/consumer/MockHttpServer.kt @@ -25,6 +25,7 @@ import com.sun.net.httpserver.HttpExchange import com.sun.net.httpserver.HttpHandler import com.sun.net.httpserver.HttpServer import com.sun.net.httpserver.HttpsServer +import io.ktor.util.network.hostname import io.pact.plugins.jvm.core.CatalogueEntry import io.pact.plugins.jvm.core.CatalogueEntryProviderType import io.pact.plugins.jvm.core.CatalogueEntryType @@ -334,7 +335,15 @@ abstract class BaseJdkMockServer( initServer() } - override fun getUrl() = "${config.scheme}://${server.address.hostName}:${server.address.port}" + override fun getUrl(): String { + // Stupid GitHub Windows agents + val host = if (server.address.hostName.lowercase() == "miningmadness.com") { + config.hostname + } else { + server.address.hostName + } + return "${config.scheme}://$host:${server.address.port}" + } override fun getPort(): Int = server.address.port diff --git a/consumer/src/main/kotlin/au/com/dius/pact/consumer/model/MockProviderConfig.kt b/consumer/src/main/kotlin/au/com/dius/pact/consumer/model/MockProviderConfig.kt index 53d511382..f5bf26dcd 100644 --- a/consumer/src/main/kotlin/au/com/dius/pact/consumer/model/MockProviderConfig.kt +++ b/consumer/src/main/kotlin/au/com/dius/pact/consumer/model/MockProviderConfig.kt @@ -53,7 +53,16 @@ open class MockProviderConfig @JvmOverloads constructor ( open val transportRegistryEntry: String = "" ) { - fun url() = "$scheme://$hostname:$port" + fun url(): String { + val address = address() + // Stupid GitHub Windows agents + val host = if (address.hostname.lowercase() == "miningmadness.com") { + hostname + } else { + address.hostname + } + return "$scheme://$host:${address.port}" + } fun address() = InetSocketAddress(hostname, port)