diff --git a/build.gradle.kts b/build.gradle.kts index b36fcfde1..9045b07ce 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ val assertjVersion = "3.27.4" val kotlinLoggingVersion = "3.0.5" val logbackVersion = "1.5.18" val nimbusSdkVersion = "11.28" -val mockWebServerVersion = "4.12.0" +val mockWebServerVersion = "5.1.0" val jacksonVersion = "2.20.0" val nettyVersion = "4.2.5.Final" val junitJupiterVersion = "5.13.4" diff --git a/src/main/kotlin/no/nav/security/mock/oauth2/debugger/Client.kt b/src/main/kotlin/no/nav/security/mock/oauth2/debugger/Client.kt index ac82cba46..99c38993d 100644 --- a/src/main/kotlin/no/nav/security/mock/oauth2/debugger/Client.kt +++ b/src/main/kotlin/no/nav/security/mock/oauth2/debugger/Client.kt @@ -10,7 +10,6 @@ import okhttp3.MediaType.Companion.toMediaType import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.internal.toHostHeader import java.net.URLEncoder import java.nio.charset.StandardCharsets import javax.net.ssl.SSLContext @@ -44,6 +43,15 @@ internal class TokenRequest( } + "\n\n$body" + private fun HttpUrl.toHostHeader(includeDefaultPort: Boolean = false): String { + val host = if (":" in host) "[$host]" else host + return if (includeDefaultPort || port != HttpUrl.defaultPort(scheme)) { + "$host:$port" + } else { + host + } + } + private fun Map.toKeyValueString(entrySeparator: String): String = this .map { "${it.key}=${it.value}" }