【fix sonar】HttpUtils文件

This commit is contained in:
梁琦涛
2023-03-10 18:04:35 +08:00
parent 42ecd47e7d
commit f765bf905f
@@ -46,8 +46,8 @@ public class HttpUtils {
}
// 获取URL上的参数
Map<String, String> urlParams = getUrlParams(request);
for (Map.Entry entry : urlParams.entrySet()) {
result.put((String)entry.getKey(), (String)entry.getValue());
for (Map.Entry<String, String> entry : urlParams.entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
Map<String, String> allRequestParam = new HashMap<>(16);
// get请求不需要拿body参数
@@ -56,8 +56,8 @@ public class HttpUtils {
}
// 将URL的参数和body参数进行合并
if (allRequestParam != null) {
for (Map.Entry entry : allRequestParam.entrySet()) {
result.put((String)entry.getKey(), (String)entry.getValue());
for (Map.Entry<String, String> entry : allRequestParam.entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
}
return result;
@@ -84,8 +84,8 @@ public class HttpUtils {
}
// 获取URL上的参数
Map<String, String> urlParams = getUrlParams(queryString);
for (Map.Entry entry : urlParams.entrySet()) {
result.put((String)entry.getKey(), (String)entry.getValue());
for (Map.Entry<String, String> entry : urlParams.entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
Map<String, String> allRequestParam = new HashMap<>(16);
// get请求不需要拿body参数
@@ -94,8 +94,8 @@ public class HttpUtils {
}
// 将URL的参数和body参数进行合并
if (allRequestParam != null) {
for (Map.Entry entry : allRequestParam.entrySet()) {
result.put((String)entry.getKey(), (String)entry.getValue());
for (Map.Entry<String, String> entry : allRequestParam.entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
}
return result;
@@ -111,7 +111,7 @@ public class HttpUtils {
public static Map getAllRequestParam(final HttpServletRequest request) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
String str = "";
String str;
StringBuilder wholeStr = new StringBuilder();
// 一行一行的读取body体里面的内容;
while ((str = reader.readLine()) != null) {