Skip to content

Commit

Permalink
Bruk post for body requests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebassonav committed Dec 3, 2024
1 parent 3a1c9b4 commit ada7e17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import io.ktor.server.response.respond
import io.ktor.server.response.respondNullable
import io.ktor.server.routing.Route
import io.ktor.server.routing.get
import io.ktor.server.routing.post
import io.ktor.server.routing.route
import no.nav.etterlatte.AuthorizationPlugin
import no.nav.etterlatte.libs.common.behandling.SakType
Expand Down Expand Up @@ -49,7 +50,7 @@ fun Route.barnepensjonVedtakRoute(
)
}

get {
post {
val paaDato = call.dato("paaDato") ?: throw ManglerFomDatoException()
val fnr = call.receiveNullable<FoedselsnummerDto>() ?: throw ManglerFoedselsnummerException()

Expand All @@ -62,7 +63,7 @@ fun Route.barnepensjonVedtakRoute(
context = PensjonContext,
)
} catch (e: IllegalArgumentException) {
return@get call.respondNullable(HttpStatusCode.BadRequest, e.message)
return@post call.respondNullable(HttpStatusCode.BadRequest, e.message)
}

call.respond(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import io.ktor.server.response.respond
import io.ktor.server.response.respondNullable
import io.ktor.server.routing.Route
import io.ktor.server.routing.get
import io.ktor.server.routing.post
import io.ktor.server.routing.route
import no.nav.etterlatte.AuthorizationPlugin
import no.nav.etterlatte.MaskinportenScopeAuthorizationPlugin
Expand Down Expand Up @@ -81,7 +82,7 @@ fun Route.samordningVedtakRoute(
call.respond(samordningVedtakDtos)
}

get {
post {
val fomDato =
call.dato("fomDato")
?: call.dato("virkFom")
Expand All @@ -103,7 +104,7 @@ fun Route.samordningVedtakRoute(
),
)
} catch (e: IllegalArgumentException) {
return@get call.respondNullable(HttpStatusCode.BadRequest, e.message)
return@post call.respondNullable(HttpStatusCode.BadRequest, e.message)
}

call.respond(samordningVedtakDtos)
Expand Down Expand Up @@ -187,7 +188,7 @@ fun Route.samordningVedtakRoute(
)
}

get("/har-loepende-oms") {
post("/har-loepende-oms") {
val paaDato = call.dato("paaDato") ?: throw ManglerPaaDatoException()
val fnr = call.receiveNullable<FoedselsnummerDto>() ?: throw ManglerFoedselsnummerException()

Expand All @@ -200,7 +201,7 @@ fun Route.samordningVedtakRoute(
context = PensjonContext,
)
} catch (e: IllegalArgumentException) {
return@get call.respondNullable(HttpStatusCode.BadRequest, e.message)
return@post call.respondNullable(HttpStatusCode.BadRequest, e.message)
}

call.respond(
Expand Down

0 comments on commit ada7e17

Please sign in to comment.