Commit 82a9e8f3 authored by 赵啸非's avatar 赵啸非

修改配置文件

parent 6798a6f6
...@@ -9,6 +9,7 @@ import org.springframework.http.ResponseEntity; ...@@ -9,6 +9,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.util.UriBuilder;
import org.springframework.web.util.UriUtils; import org.springframework.web.util.UriUtils;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
...@@ -50,12 +51,14 @@ public class ProxyController { ...@@ -50,12 +51,14 @@ public class ProxyController {
params.remove("path"); params.remove("path");
String targetUrl = "http://127.0.0.1:11078/basic_api/" + path; String targetUrl = "127.0.0.1:11078/basic_api/" + path;
log.info("proxyPost targetUrl: {}", targetUrl); log.info("proxyPost targetUrl: {}", targetUrl);
if ("post".equalsIgnoreCase(method)) { if ("post".equalsIgnoreCase(method)) {
return webClient.post() return webClient.post()
.uri(uriBuilder -> { .uri(uriBuilder -> {
uriBuilder.scheme("http");
uriBuilder.path(targetUrl); uriBuilder.path(targetUrl);
params.forEach((key, value) -> params.forEach((key, value) ->
uriBuilder.queryParam(key, UriUtils.encode(value, StandardCharsets.UTF_8)) uriBuilder.queryParam(key, UriUtils.encode(value, StandardCharsets.UTF_8))
); );
...@@ -73,4 +76,10 @@ public class ProxyController { ...@@ -73,4 +76,10 @@ public class ProxyController {
} }
return Mono.just(ResponseEntity.ok().body(JSON.toJSONString(rsp))); return Mono.just(ResponseEntity.ok().body(JSON.toJSONString(rsp)));
} }
public static void main(String[] args) {
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment