Skip to content

Commit 6b258e7

Browse files
committed
Fikse default httpklient til å respektere http proxy
1 parent d437884 commit 6b258e7

File tree

1 file changed

+11
-10
lines changed
  • oauth2-klient/src/main/kotlin/no/nav/dagpenger/oauth2

1 file changed

+11
-10
lines changed

oauth2-klient/src/main/kotlin/no/nav/dagpenger/oauth2/HttpClient.kt

+11-10
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@ import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
1111
import io.ktor.serialization.jackson.jackson
1212

1313
@JvmOverloads
14-
fun defaultHttpClient(httpClientEngine: HttpClientEngine = CIO.create()) =
15-
HttpClient(httpClientEngine) {
16-
expectSuccess = true
17-
install(ContentNegotiation) {
18-
jackson {
19-
configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
20-
setSerializationInclusion(JsonInclude.Include.NON_NULL)
21-
}
22-
}
23-
engine {
14+
fun defaultHttpClient(
15+
httpClientEngine: HttpClientEngine =
16+
CIO.create {
2417
System.getenv("HTTP_PROXY")?.let {
2518
this.proxy = ProxyBuilder.http(it)
2619
}
20+
},
21+
) = HttpClient(httpClientEngine) {
22+
expectSuccess = true
23+
install(ContentNegotiation) {
24+
jackson {
25+
configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
26+
setSerializationInclusion(JsonInclude.Include.NON_NULL)
2727
}
2828
}
29+
}

0 commit comments

Comments
 (0)