从请求中获取参数并以+=拼接的方式,使用更为优雅的流式拼接

This commit is contained in:
afei 2022-04-04 10:41:26 +08:00
parent aa16ada8ca
commit 0411d0354a
1 changed files with 2 additions and 5 deletions

View File

@ -31,6 +31,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.Map;
import java.util.stream.Collectors;
/*
* 基于spring的 req 工具类
@ -83,11 +84,7 @@ public class RequestKitBean {
String body = "";
try {
String str;
while((str = request.getReader().readLine()) != null){
body += str;
}
body=request.getReader().lines().collect(Collectors.joining(""));
if(StringUtils.isEmpty(body)) {
return returnObject;
}