Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ private String getAddressFromEndpoint(Endpoint endpoint) {

private Mono<String> performRequest(RequestHeadersSpec<? extends RequestHeadersSpec<?>> request) {
return request.retrieve()
.bodyToMono(String.class);
.bodyToMono(String.class)
.doOnError(e -> LOGGER.error("SDS request failed: {}", e));
}

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ private HttpClient getHttpClient() {
}

private void addWebClientFilters(List<ExchangeFilterFunction> filters) {
filters.add(webClientFilterService.errorHandlingFilter(WebClientFilterService.RequestType.SDS, HttpStatus.OK));
filters.add(webClientFilterService.logRequest());
filters.add(webClientFilterService.errorHandlingFilter(WebClientFilterService.RequestType.SDS, HttpStatus.OK));
filters.add(webClientFilterService.logResponse());
}
Comment thread
ORybak5 marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,24 @@ public ExchangeFilterFunction errorHandlingFilter(RequestType requestType, HttpS

public ExchangeFilterFunction logRequest() {
return (clientRequest, next) -> {
LOGGER.info("Outbound request: {} {}", clientRequest.method(), clientRequest.url());
if (LOGGER.isDebugEnabled()) {
var headers = clientRequest.headers().entrySet().stream()
.map(e -> e.getKey() + ": " + e.getValue())
.collect(Collectors.joining(System.lineSeparator()));
LOGGER.debug("Request: {} {} \n{}", clientRequest.method(), clientRequest.url(), headers);
LOGGER.debug("Outbound request headers for {} {}:\n{}", clientRequest.method(), clientRequest.url(), headers);
Comment thread
ORybak5 marked this conversation as resolved.
}
return next.exchange(clientRequest);
};
}

public ExchangeFilterFunction logResponse() {
return ExchangeFilterFunction.ofResponseProcessor(clientResponse -> {
LOGGER.info("Outbound response status: {}", clientResponse.statusCode());
return Mono.just(clientResponse);
});
}
Comment thread
ORybak5 marked this conversation as resolved.

private Mono<ClientResponse> getResponseError(ClientResponse clientResponse, RequestType requestType) {
var exceptionBuilder = REQUEST_TYPE_TO_EXCEPTION_MAP
.getOrDefault(requestType, InvalidOutboundMessageException::new);
Expand Down
Loading