Commit e5df8643 authored by 赵啸非's avatar 赵啸非

修改配置文件

parent 913a224a
......@@ -34,11 +34,20 @@ public class ProxyController {
@RequestHeader Map<String, String> headers // 透传 Headers
) {
String path = params.getOrDefault("path", "");
log.info("proxyPost params: {}, body: {}, headers: {}", params, body, headers);
ApiResp<String> rsp = new ApiResp<>();
if (!ObjectUtils.isEmpty(path)) {
String targetUrl = "http://127.0.0.1:11072/basic_api/" + path;
String path = params.getOrDefault("path", "");
if (ObjectUtils.isEmpty(path)) {
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
rsp.setMsg("path is empty!");
return Mono.just(ResponseEntity.ok().body(JSON.toJSONString(rsp)));
}
String method = params.getOrDefault("method", "post");
String targetUrl = "http://127.0.0.1:11072/basic_api/" + path;
if ("post".equalsIgnoreCase(method)) {
return webClient.post()
.uri(uriBuilder -> {
uriBuilder.path(targetUrl);
......@@ -51,13 +60,11 @@ public class ProxyController {
.bodyValue(body != null ? body : "") // 透传 Body
.retrieve()
.toEntity(String.class);
} else {
} else if ("get".equalsIgnoreCase(method)) {
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
rsp.setMsg("path is empty!");
return Mono.just(ResponseEntity.ok().body(JSON.toJSONString(rsp)));
} else {
//不支持
}
return Mono.just(ResponseEntity.ok().body(JSON.toJSONString(rsp)));
}
}
......@@ -63,7 +63,7 @@ Content-Type: application/json
}
###透传代理接口
POST {{baseUrl}}/proxy/post?path=
POST {{baseUrl}}/proxy/post?path=/ent/life/cycle/interlist&method=post
Content-Type: application/json
{}
......
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