Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
xiaoyu 2021-07-02 11:57:31 +08:00
commit a7231b5b44

View File

@ -49,20 +49,27 @@ public class RequestKitBean {
/** reqContext对象中的key: 转换好的json对象 */
private static final String REQ_CONTEXT_KEY_PARAMJSON = "REQ_CONTEXT_KEY_PARAMJSON";
/**request.getParameter 获取参数 并转换为JSON格式 **/
/** JSON 格式通过请求主体BODY传输 获取参数 **/
public String getReqParamFromBody() {
String body = "";
try {
String str;
while((str = request.getReader().readLine()) != null){
body += str;
if(isConvertJSON()){
try {
String str;
while((str = request.getReader().readLine()) != null){
body += str;
}
return body;
} catch (Exception e) {
log.error("请求参数转换异常! params=[{}]", body);
throw new BizException(ApiCodeEnum.PARAMS_ERROR, "转换异常");
}
}else {
return body;
} catch (Exception e) {
log.error("请求参数转换异常! params=[{}]", body);
throw new BizException(ApiCodeEnum.PARAMS_ERROR, "转换异常");
}
}