Skip to content

Commit

Permalink
Lagt på mere logging II #deploy-tenor-search-service
Browse files Browse the repository at this point in the history
  • Loading branch information
krharum committed Jan 12, 2024
1 parent 251f768 commit 442b739
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package no.nav.testnav.apps.tenorsearchservice.consumers;

import lombok.extern.slf4j.Slf4j;
import no.nav.testnav.apps.tenorsearchservice.config.Consumers;
import no.nav.testnav.apps.tenorsearchservice.consumers.command.GetTenorTestdata;
import no.nav.testnav.apps.tenorsearchservice.domain.TenorResponse;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.util.DefaultUriBuilderFactory;
import reactor.core.publisher.Mono;

@Slf4j
@Service
public class TenorClient {

private static final String TENOR_QUERY_URL = "/api/testnorge/v2/soek/freg";
private final WebClient webClient;
private final MaskinportenClient maskinportenClient;

Expand All @@ -24,6 +28,16 @@ public TenorClient(Consumers consumers, MaskinportenClient maskinportenClient) {

public Mono<TenorResponse> getTestdata(String query) {

log.info("URI output: {}", new DefaultUriBuilderFactory().uriString(TENOR_QUERY_URL)
.queryParam("kql", query)
.queryParam("nokkelinformasjon", true)
.build());

log.info("URI output 2: {}", new DefaultUriBuilderFactory().uriString(TENOR_QUERY_URL)
.queryParam("kql", query)
.queryParam("nokkelinformasjon", true)
.build(false));

return maskinportenClient.getAccessToken()
.flatMap(token -> new GetTenorTestdata(webClient, query, token.value()).call());
}
Expand Down

0 comments on commit 442b739

Please sign in to comment.