diff --git a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/consumers/TenorClient.java b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/consumers/TenorClient.java index 48c2c20e305..b60775e5c4c 100644 --- a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/consumers/TenorClient.java +++ b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/consumers/TenorClient.java @@ -25,9 +25,6 @@ public TenorClient(Consumers consumers, MaskinportenClient maskinportenClient) { public Mono getTestdata(String query) { return maskinportenClient.getAccessToken() - .flatMap(token -> new GetTenorTestdata(webClient, - query.replace("{", "%7b") - .replace("}", "%7d"), - token.value()).call()); + .flatMap(token -> new GetTenorTestdata(webClient, query, token.value()).call()); } } diff --git a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/consumers/command/GetTenorTestdata.java b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/consumers/command/GetTenorTestdata.java index 4fb11101b5b..6afa47e8e16 100644 --- a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/consumers/command/GetTenorTestdata.java +++ b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/consumers/command/GetTenorTestdata.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.databind.JsonNode; import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import no.nav.testnav.apps.tenorsearchservice.domain.TenorResponse; import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; @@ -13,7 +12,6 @@ import reactor.core.publisher.Mono; import reactor.util.retry.Retry; -import java.net.URI; import java.time.Duration; import java.util.concurrent.Callable; @@ -21,20 +19,22 @@ @RequiredArgsConstructor public class GetTenorTestdata implements Callable> { - private static final String TENOR_QUERY_URL = "/api/testnorge/v2/soek/freg?kql="; + private static final String TENOR_QUERY_URL = "/api/testnorge/v2/soek/freg"; private final WebClient webClient; private final String query; private final String token; @Override - @SneakyThrows public Mono call() { log.info("Query-parameter: {}", query); return webClient.get() - .uri(new URI(TENOR_QUERY_URL+query+"nokkelinformasjon:true")) + .uri(uriBuilder -> uriBuilder.path(TENOR_QUERY_URL) + .queryParam("kql", query) + .queryParam("nokkelinformasjon", true) + .build()) .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) .retrieve()