Skip to content

Commit fc5b017

Browse files
authored
build: bump okhttp to 5.1 (#884)
1 parent 61e09e1 commit fc5b017

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ val assertjVersion = "3.27.4"
66
val kotlinLoggingVersion = "3.0.5"
77
val logbackVersion = "1.5.18"
88
val nimbusSdkVersion = "11.28"
9-
val mockWebServerVersion = "4.12.0"
9+
val mockWebServerVersion = "5.1.0"
1010
val jacksonVersion = "2.20.0"
1111
val nettyVersion = "4.2.5.Final"
1212
val junitJupiterVersion = "5.13.4"

src/main/kotlin/no/nav/security/mock/oauth2/debugger/Client.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import okhttp3.MediaType.Companion.toMediaType
1010
import okhttp3.OkHttpClient
1111
import okhttp3.Request
1212
import okhttp3.RequestBody.Companion.toRequestBody
13-
import okhttp3.internal.toHostHeader
1413
import java.net.URLEncoder
1514
import java.nio.charset.StandardCharsets
1615
import javax.net.ssl.SSLContext
@@ -44,6 +43,15 @@ internal class TokenRequest(
4443
} +
4544
"\n\n$body"
4645

46+
private fun HttpUrl.toHostHeader(includeDefaultPort: Boolean = false): String {
47+
val host = if (":" in host) "[$host]" else host
48+
return if (includeDefaultPort || port != HttpUrl.defaultPort(scheme)) {
49+
"$host:$port"
50+
} else {
51+
host
52+
}
53+
}
54+
4755
private fun Map<String, String>.toKeyValueString(entrySeparator: String): String =
4856
this
4957
.map { "${it.key}=${it.value}" }

0 commit comments

Comments
 (0)