|
14 | 14 | import org.springframework.web.context.request.ServletRequestAttributes;
|
15 | 15 | import org.springframework.web.reactive.function.client.WebClient;
|
16 | 16 | import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
17 |
| -import org.springframework.web.util.UriComponentsBuilder; |
18 | 17 | import org.yaml.snakeyaml.Yaml;
|
19 | 18 |
|
20 | 19 | import java.io.IOException;
|
21 | 20 | import java.io.InputStream;
|
22 |
| -import java.net.URLDecoder; |
23 |
| -import java.nio.charset.StandardCharsets; |
24 | 21 | import java.util.*;
|
25 | 22 |
|
26 | 23 | @Getter
|
@@ -56,7 +53,6 @@ public String getBaseUrl(HttpServletRequest request) {
|
56 | 53 |
|
57 | 54 | public Map<?, ?> getResultFromUrlReactive(String url) {
|
58 | 55 | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
59 |
| - |
60 | 56 | return webClient.get()
|
61 | 57 | .uri(getBaseUrl(request) + url)
|
62 | 58 | .retrieve()
|
@@ -90,12 +86,13 @@ private void loadExamplesFromYaml() {
|
90 | 86 | }
|
91 | 87 |
|
92 | 88 | public Map<String, Object> checkEndpoint(String endpoint) {
|
93 |
| - endpoint = URLDecoder.decode(endpoint, StandardCharsets.UTF_8); |
94 |
| - String url = UriComponentsBuilder.fromUriString(endpoint) |
95 |
| - .queryParam("showResponseConfiguration", "true") |
96 |
| - .toUriString(); |
| 89 | + if(endpoint.contains("?")){ |
| 90 | + endpoint += "&showResponseConfiguration=true"; |
| 91 | + } else { |
| 92 | + endpoint += "?showResponseConfiguration=true"; |
| 93 | + } |
97 | 94 |
|
98 |
| - return calculateGlobalStats(url); |
| 95 | + return calculateGlobalStats(endpoint); |
99 | 96 | }
|
100 | 97 |
|
101 | 98 | private Map<String, Object> calculateGlobalStats(String exampleUrl) {
|
|
0 commit comments