Skip to content

Commit 69a41eb

Browse files
committed
Fjern logging av epostrequest
1 parent 22bab7c commit 69a41eb

File tree

1 file changed

+3
-19
lines changed
  • app/src/main/kotlin/no/nav/hjelpemidler/soknad/db/rapportering/epost

1 file changed

+3
-19
lines changed

app/src/main/kotlin/no/nav/hjelpemidler/soknad/db/rapportering/epost/GraphClient.kt

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,8 @@ package no.nav.hjelpemidler.soknad.db.rapportering.epost
33
import io.github.oshai.kotlinlogging.KotlinLogging
44
import io.ktor.client.HttpClient
55
import io.ktor.client.engine.apache.Apache
6-
import io.ktor.client.plugins.defaultRequest
7-
import io.ktor.client.plugins.logging.LogLevel
8-
import io.ktor.client.plugins.logging.Logging
9-
import io.ktor.client.request.accept
106
import io.ktor.client.request.post
117
import io.ktor.client.request.setBody
12-
import io.ktor.http.ContentType
13-
import io.ktor.http.contentType
148
import kotlinx.coroutines.Dispatchers
159
import kotlinx.coroutines.withContext
1610
import no.nav.hjelpemidler.http.createHttpClient
@@ -23,32 +17,22 @@ class GraphClient(
2317
private val openIDClient: OpenIDClient,
2418
private val httpClient: HttpClient = createHttpClient(Apache.create()) {
2519
expectSuccess = true
26-
27-
// TODO fjern logging
28-
install(Logging) {
29-
level = LogLevel.BODY
30-
}
31-
32-
defaultRequest {
33-
accept(ContentType.Application.Json)
34-
contentType(ContentType.Application.Json)
35-
}
3620
},
3721
private val baseUrl: String = "https://graph.microsoft.com/v1.0",
3822
private val scope: String = "https://graph.microsoft.com/.default",
3923
) {
4024

41-
suspend fun sendEpost(request: SendMailRequest, avsender: String) {
25+
suspend fun sendEpost(epostRequest: SendMailRequest, avsender: String) {
4226
try {
4327
withContext(Dispatchers.IO) {
4428
val tokenSet = openIDClient.grant(scope)
4529
httpClient.post("$baseUrl/users/$avsender/sendMail") {
4630
bearerAuth(tokenSet)
47-
setBody(request)
31+
setBody(epostRequest)
4832
}
4933
}
5034
} catch (t: Throwable) {
51-
log.error(t) { "Sending av epost feilet for $request, avsender=$avsender" }
35+
log.error(t) { "Sending av epost feilet for $epostRequest, avsender=$avsender" }
5236
throw t
5337
}
5438
}

0 commit comments

Comments
 (0)