From 2c0860d1498f8ca93856208eb55e5af0d56803fe Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Thu, 13 Jun 2024 09:11:30 +0200 Subject: [PATCH] Remove explicit MediaType and add logging in skattekort service #deploy-skattekort-service The explicit setting of MediaType.TEXT_PLAIN_VALUE in SkattekortController has been removed, making the @GetMapping annotation default to all media types. Additionally, a logging statement was added in SkattekortService to log the response after consuming a skatteKort. A default "content-type" header was removed from SokosSkattekortConsumer. --- .../skattekortservice/consumer/SokosSkattekortConsumer.java | 1 - .../nav/skattekortservice/provider/SkattekortController.java | 2 +- .../no/nav/skattekortservice/service/SkattekortService.java | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/skattekort-service/src/main/java/no/nav/skattekortservice/consumer/SokosSkattekortConsumer.java b/apps/skattekort-service/src/main/java/no/nav/skattekortservice/consumer/SokosSkattekortConsumer.java index ed1d9224987..a1055c2bb60 100644 --- a/apps/skattekort-service/src/main/java/no/nav/skattekortservice/consumer/SokosSkattekortConsumer.java +++ b/apps/skattekort-service/src/main/java/no/nav/skattekortservice/consumer/SokosSkattekortConsumer.java @@ -23,7 +23,6 @@ public SokosSkattekortConsumer(TokenExchange tokenExchange, Consumers consumers) this.serverProperties = consumers.getSokosSkattekort(); this.webClient = WebClient.builder() .baseUrl(serverProperties.getUrl()) - .defaultHeader("content-type", "application/json") .build(); this.tokenExchange = tokenExchange; } diff --git a/apps/skattekort-service/src/main/java/no/nav/skattekortservice/provider/SkattekortController.java b/apps/skattekort-service/src/main/java/no/nav/skattekortservice/provider/SkattekortController.java index 1c450736a90..5863379bcfe 100644 --- a/apps/skattekort-service/src/main/java/no/nav/skattekortservice/provider/SkattekortController.java +++ b/apps/skattekort-service/src/main/java/no/nav/skattekortservice/provider/SkattekortController.java @@ -25,7 +25,7 @@ public Mono sendSkattekort(@RequestBody SkattekortTilArbeidsgiverDTO ska return skattekortService.sendSkattekort(skattekort); } - @GetMapping(produces = MediaType.TEXT_PLAIN_VALUE) + @GetMapping public Mono hentSkattekort(@RequestBody SokosGetRequest request) { return skattekortService.hentSkattekort(request); diff --git a/apps/skattekort-service/src/main/java/no/nav/skattekortservice/service/SkattekortService.java b/apps/skattekort-service/src/main/java/no/nav/skattekortservice/service/SkattekortService.java index 86e24ed426f..0b8e9813cf3 100644 --- a/apps/skattekort-service/src/main/java/no/nav/skattekortservice/service/SkattekortService.java +++ b/apps/skattekort-service/src/main/java/no/nav/skattekortservice/service/SkattekortService.java @@ -73,6 +73,7 @@ private String encodeRequest(String request) { public Mono hentSkattekort(SokosGetRequest request) { - return skattekortConsumer.hentSkattekort(request); + return skattekortConsumer.hentSkattekort(request) + .doOnNext(response -> log.info("Hentet resultat fra Sokos {}", response)); } }