Skip to content

Commit

Permalink
Merge pull request #113 from navikt/dev-with-context
Browse files Browse the repository at this point in the history
wrap receive i with context
  • Loading branch information
heyvard committed Mar 3, 2021
2 parents 029c0e4 + 6644580 commit df851d0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/kotlin/no/nav/helse/flex/vedtak/api/VedtakMockApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import io.ktor.routing.delete
import io.ktor.routing.post
import io.ktor.routing.route
import io.ktor.util.KtorExperimentalAPI
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import no.nav.helse.flex.Environment
import no.nav.helse.flex.vedtak.service.VedtakNullstillService
import no.nav.helse.flex.vedtak.service.VedtakService
Expand All @@ -28,7 +30,9 @@ fun Route.registerVedtakMockApi(vedtakService: VedtakService, env: Environment,
throw IllegalStateException("Dette apiet er ikke på i produksjon")
}
val fnr = call.parameters["fnr"]!!
val vedtak = call.receiveTextWithCorrectEncoding()
val vedtak = withContext(Dispatchers.IO) {
call.receiveTextWithCorrectEncoding()
}
val vedtakId = UUID.randomUUID()
vedtakService.mottaVedtak(
id = vedtakId,
Expand All @@ -44,7 +48,9 @@ fun Route.registerVedtakMockApi(vedtakService: VedtakService, env: Environment,
throw IllegalStateException("Dette apiet er ikke på i produksjon")
}
val fnr = call.parameters["fnr"]!!
val annullering = call.receiveTextWithCorrectEncoding()
val annullering = withContext(Dispatchers.IO) {
call.receiveTextWithCorrectEncoding()
}
val annulleringId = UUID.randomUUID()
vedtakService.mottaAnnullering(
id = annulleringId,
Expand Down

0 comments on commit df851d0

Please sign in to comment.