Skip to content

Commit

Permalink
feature(Util): remove 'content-type' judgment
Browse files Browse the repository at this point in the history
  • Loading branch information
liukai committed Sep 14, 2023
1 parent a241aa3 commit 54884dc
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions framework/src/main/java/org/tron/core/services/http/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,6 @@ public static byte[] getAddress(HttpServletRequest request) throws Exception {

private static String checkGetParam(HttpServletRequest request, String key) throws Exception {
String method = request.getMethod();
String value = null;

if (HttpMethod.GET.toString().toUpperCase().equalsIgnoreCase(method)) {
return request.getParameter(key);
Expand All @@ -534,8 +533,10 @@ private static String checkGetParam(HttpServletRequest request, String key) thro
if (StringUtils.isBlank(contentType)) {
return null;
}
if (contentType.contains(MimeTypes.Type.APPLICATION_JSON.asString())) {
value = getRequestValue(request);
if (contentType.contains(MimeTypes.Type.FORM_ENCODED.asString())) {
return request.getParameter(key);
} else {
String value = getRequestValue(request);
if (StringUtils.isBlank(value)) {
return null;
}
Expand All @@ -544,13 +545,10 @@ private static String checkGetParam(HttpServletRequest request, String key) thro
if (jsonObject != null) {
return jsonObject.getString(key);
}
} else if (contentType.contains(MimeTypes.Type.FORM_ENCODED.asString())) {
return request.getParameter(key);
} else {
return null;
}
}
return value;
return null;
}

public static String getRequestValue(HttpServletRequest request) throws IOException {
Expand Down

0 comments on commit 54884dc

Please sign in to comment.