记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
778ec962
Commit
778ec962
authored
Apr 20, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改http请求header
parent
d401176a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
HttpUtil.java
...c/main/java/com/liquidnet/commons/lang/util/HttpUtil.java
+3
-4
No files found.
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/HttpUtil.java
View file @
778ec962
...
@@ -104,8 +104,8 @@ public class HttpUtil {
...
@@ -104,8 +104,8 @@ public class HttpUtil {
public
static
String
postJson
(
String
url
,
String
jsonStr
,
MultiValueMap
<
String
,
String
>
headers
)
{
public
static
String
postJson
(
String
url
,
String
jsonStr
,
MultiValueMap
<
String
,
String
>
headers
)
{
MultiValueMap
<
String
,
String
>
commonHeader
=
CollectionUtil
.
linkedMultiValueMapStringString
();
MultiValueMap
<
String
,
String
>
commonHeader
=
CollectionUtil
.
linkedMultiValueMapStringString
();
headers
.
add
(
"Content-Type"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
commonHeader
.
add
(
"Content-Type"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
commonHeader
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
if
(
url
==
null
||
url
.
trim
().
isEmpty
())
{
if
(
url
==
null
||
url
.
trim
().
isEmpty
())
{
return
null
;
return
null
;
...
@@ -119,8 +119,7 @@ public class HttpUtil {
...
@@ -119,8 +119,7 @@ public class HttpUtil {
if
(
headers
!=
null
)
{
if
(
headers
!=
null
)
{
httpHeaders
.
addAll
(
headers
);
httpHeaders
.
addAll
(
headers
);
}
}
System
.
out
.
println
(
"httpHeaders:"
+
JsonUtils
.
toJson
(
httpHeaders
));
System
.
out
.
println
(
"httpHeaders.size:"
+
JsonUtils
.
toJson
(
httpHeaders
).
length
());
HttpEntity
<
Object
>
httpEntity
=
new
HttpEntity
(
jsonStr
,
httpHeaders
);
HttpEntity
<
Object
>
httpEntity
=
new
HttpEntity
(
jsonStr
,
httpHeaders
);
// 提交方式:表单、json
// 提交方式:表单、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