Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
enterprise-service-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
enterprise-service-platform
Commits
e5df8643
Commit
e5df8643
authored
Mar 19, 2025
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改配置文件
parent
913a224a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
enterprise-service-manager/src/main/java/com/mortals/xhx/busiz/web/ProxyController.java
.../main/java/com/mortals/xhx/busiz/web/ProxyController.java
+16
-9
enterprise-service-manager/src/test/java/com/mortals/httpclient/system.http
...-manager/src/test/java/com/mortals/httpclient/system.http
+1
-1
No files found.
enterprise-service-manager/src/main/java/com/mortals/xhx/busiz/web/ProxyController.java
View file @
e5df8643
...
...
@@ -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
)));
}
}
enterprise-service-manager/src/test/java/com/mortals/httpclient/system.http
View file @
e5df8643
...
...
@@ -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
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment