From d5226bbc456b2a55e3190f8644cd04d6f3b8cb47 Mon Sep 17 00:00:00 2001 From: Jens-Otto Larsen Date: Thu, 23 May 2024 21:31:05 +0200 Subject: [PATCH] =?UTF-8?q?Sp=C3=B8kelse=20POST=20isf=20GET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractSp\303\270kelseKlient.java" | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git "a/integrasjon/spokelse-klient/src/main/java/no/nav/vedtak/felles/integrasjon/spokelse/AbstractSp\303\270kelseKlient.java" "b/integrasjon/spokelse-klient/src/main/java/no/nav/vedtak/felles/integrasjon/spokelse/AbstractSp\303\270kelseKlient.java" index 0fa8fcfad..b959cb196 100644 --- "a/integrasjon/spokelse-klient/src/main/java/no/nav/vedtak/felles/integrasjon/spokelse/AbstractSp\303\270kelseKlient.java" +++ "b/integrasjon/spokelse-klient/src/main/java/no/nav/vedtak/felles/integrasjon/spokelse/AbstractSp\303\270kelseKlient.java" @@ -2,12 +2,8 @@ import java.time.Duration; import java.time.LocalDate; -import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.List; -import java.util.Optional; - -import jakarta.ws.rs.core.UriBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,12 +48,14 @@ public List hentGrunnlag(String fnr, LocalDate fom) { @Override public List hentGrunnlag(String fnr, LocalDate fom, Duration timeout) { + if (fnr == null || fnr.isEmpty()) { + throw new IllegalArgumentException("Ikke angitt fnr"); + } try { - var pathBuilder = UriBuilder.fromUri(restConfig.endpoint()).queryParam("fodselsnummer", fnr); - Optional.ofNullable(fom).ifPresent(f -> pathBuilder.queryParam("fom", f.format(DateTimeFormatter.ISO_LOCAL_DATE))); - var request = RestRequest.newGET(pathBuilder.build(), restConfig).timeout(timeout); - var grunnlag = restKlient.send(request, SykepengeVedtak[].class); - return Arrays.asList(grunnlag); + var request = new GrunnlagRequest(fnr, fom); + var rrequest = RestRequest.newPOSTJson(request, restConfig.endpoint(), restConfig); + var resultat = restKlient.send(rrequest, SykepengeVedtak[].class); + return Arrays.asList(resultat); } catch (Exception e) { throw new TekniskException("FP-180126", String.format("SPokelse %s gir feil, ta opp med team sykepenger.", restConfig.endpoint().toString()), e); @@ -78,4 +76,6 @@ public List hentGrunnlagFailSoft(String fnr, LocalDate fom) { return List.of(); } } + + public record GrunnlagRequest(String fodselsnummer, LocalDate fom) { } }