Skip to content

Commit

Permalink
Oppdatert dekoding II #deploy-tenor-search-service
Browse files Browse the repository at this point in the history
  • Loading branch information
krharum committed Jan 13, 2024
1 parent 87dc369 commit 3428ff4
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import no.nav.testnav.libs.reactivecore.utils.WebClientFilter;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.util.DefaultUriBuilderFactory;
import reactor.core.publisher.Mono;
import reactor.util.retry.Retry;

Expand All @@ -33,18 +31,13 @@ public Mono<TenorResponse> call() {

log.info("Query-parameter: {}", query);

var uri = new DefaultUriBuilderFactory(TENOR_QUERY_URL);
uri.setEncodingMode(DefaultUriBuilderFactory.EncodingMode.NONE);
var ui = uri.builder()
.queryParam("kql", URLEncoder.encode(query, StandardCharsets.UTF_8))
.queryParam("nokkelinformasjon", true)
.build();
log.info("URI output: {}", ui);

return webClient.get()
.uri(ui)
.uri(uriBuilder -> uriBuilder
.path(TENOR_QUERY_URL)
.queryParam("kql", URLEncoder.encode(query, StandardCharsets.UTF_8))
.queryParam("nokkelinformasjon", true)
.build())
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
.retrieve()
.bodyToMono(JsonNode.class)
.map(response -> TenorResponse.builder()
Expand Down

0 comments on commit 3428ff4

Please sign in to comment.