Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use hostname instead of canonicalHostname #586

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ MockWebServerWrapper
val ssl: Ssl? = null,
) : OAuth2HttpServer {
val mockWebServer: MockWebServer = MockWebServer()
private var address: InetAddress? = null

override fun start(
inetAddress: InetAddress,
Expand All @@ -90,6 +91,7 @@ MockWebServerWrapper
if (ssl != null) {
mockWebServer.useHttps(ssl.sslContext().socketFactory, false)
}
this.address = inetAddress
log.debug("started server on address=$inetAddress and port=${mockWebServer.port}, httpsEnabled=${ssl != null}")
}

Expand All @@ -100,7 +102,11 @@ MockWebServerWrapper

override fun port(): Int = mockWebServer.port

override fun url(path: String): HttpUrl = mockWebServer.url(path)
override fun url(path: String): HttpUrl = mockWebServer
.url(path)
.newBuilder()
.host(address?.hostName ?: mockWebServer.hostName)
.build()

override fun sslConfig(): Ssl? = ssl

Expand Down Expand Up @@ -189,7 +195,7 @@ class NettyWrapper
}
return HttpUrl.Builder()
.scheme(scheme)
.host(address.address.canonicalHostName)
.host(address.address.hostName)
.port(port())
.build()
.resolve(path)!!
Expand Down