|
17 | 17 | package org.springframework.web.reactive.function.client;
|
18 | 18 |
|
19 | 19 | import java.net.URI;
|
| 20 | +import java.net.URISyntaxException; |
20 | 21 | import java.nio.charset.Charset;
|
21 | 22 | import java.time.ZonedDateTime;
|
22 | 23 | import java.util.ArrayList;
|
|
49 | 50 | import org.springframework.util.CollectionUtils;
|
50 | 51 | import org.springframework.util.LinkedMultiValueMap;
|
51 | 52 | import org.springframework.util.MultiValueMap;
|
| 53 | +import org.springframework.util.StringUtils; |
52 | 54 | import org.springframework.web.reactive.function.BodyExtractor;
|
53 | 55 | import org.springframework.web.reactive.function.BodyInserter;
|
54 | 56 | import org.springframework.web.reactive.function.BodyInserters;
|
@@ -667,10 +669,22 @@ private <T> Mono<T> applyStatusHandlers(ClientResponse response) {
|
667 | 669 | }
|
668 | 670 |
|
669 | 671 | private <T> Mono<T> insertCheckpoint(Mono<T> result, int statusCode, HttpRequest request) {
|
670 |
| - String httpMethod = request.getMethodValue(); |
| 672 | + String method = request.getMethodValue(); |
| 673 | + URI uri = getUriToLog(request); |
| 674 | + return result.checkpoint(statusCode + " from " + method + " " + uri + " [DefaultWebClient]"); |
| 675 | + } |
| 676 | + |
| 677 | + private static URI getUriToLog(HttpRequest request) { |
671 | 678 | URI uri = request.getURI();
|
672 |
| - String description = statusCode + " from " + httpMethod + " " + uri + " [DefaultWebClient]"; |
673 |
| - return result.checkpoint(description); |
| 679 | + if (StringUtils.hasText(uri.getQuery())) { |
| 680 | + try { |
| 681 | + uri = new URI(uri.getScheme(), uri.getHost(), uri.getPath(), null); |
| 682 | + } |
| 683 | + catch (URISyntaxException ex) { |
| 684 | + // ignore |
| 685 | + } |
| 686 | + } |
| 687 | + return uri; |
674 | 688 | }
|
675 | 689 |
|
676 | 690 |
|
|
0 commit comments