当前位置: 首页 > news >正文

HTTP Error 400 Bad request 问题分析解决

在这里插入图片描述

文章目录

      • 1.问题描述:
      • 2.异常信息如下:
      • 3.分析异常信息:
      • 4.总结:


1.问题描述:

前端保存老是报错HTTP ERROR 400 Bad Request。经过异常分析得出是前端传参导致的后端框架的验证拦截,包的错误。

2.异常信息如下:


{"timestamp":1545873831082,"status":400,"error":"Bad Request","exception":"org.springframework.validation.BindException","errors":[{"codes":["typeMismatch.capitalInvestmentParam.investmentEnsureMoney","typeMismatch.investmentEnsureMoney","typeMismatch.java.math.BigDecimal","typeMismatch"],"arguments":[{"codes":["capitalInvestmentParam.investmentEnsureMoney","investmentEnsureMoney"],"arguments":null,"defaultMessage":"investmentEnsureMoney","code":"investmentEnsureMoney"}],"defaultMessage":"Failed to convert property value of type 'java.lang.String' to required type 'java.math.BigDecimal' for property 'investmentEnsureMoney'; nested exception is java.lang.NumberFormatException","objectName":"capitalInvestmentParam","field":"investmentEnsureMoney","rejectedValue":"null","bindingFailure":true,"code":"typeMismatch"},{"codes":["typeMismatch.capitalInvestmentParam.investmentEnsureMoneyInterest","typeMismatch.investmentEnsureMoneyInterest","typeMismatch.java.math.BigDecimal","typeMismatch"],"arguments":[{"codes":["capitalInvestmentParam.investmentEnsureMoneyInterest","investmentEnsureMoneyInterest"],"arguments":null,"defaultMessage":"investmentEnsureMoneyInterest","code":"investmentEnsureMoneyInterest"}],"defaultMessage":"Failed to convert property value of type 'java.lang.String' to required type 'java.math.BigDecimal' for property 'investmentEnsureMoneyInterest'; nested exception is java.lang.NumberFormatException","objectName":"capitalInvestmentParam","field":"investmentEnsureMoneyInterest","rejectedValue":"null","bindingFailure":true,"code":"typeMismatch"}],"message":"Validation failed for object='capitalInvestmentParam'. Error count: 2","path":"/rayProjectCapitalInvestment/insertStockPowerInvestment"}

3.分析异常信息:

Failed to convert property value of type ‘java.lang.String’ to required type ‘java.math.BigDecimal’ for property ‘investmentEnsureMoneyInterest’; nested exception is java.lang.NumberFormatException

看一下前端传入的参数如下图:
image.png
image.png
前端的参数应该是金额要么是空值,结果传输的时候传一个null,后台接收的时候是用bigDecimal 参数类型导致参数异常,报的400错误问题。

4.总结:

经过分析得出400错误code:数据框架的验证拦截前端传入的参数异常,参数类型异常,一般情况下出现400,都是前端传入的参数异常。


文章转载自:

http://meofJVqO.wfzLt.cn
http://3iZzGNg8.wfzLt.cn
http://is4ZH4tE.wfzLt.cn
http://NR45k1oY.wfzLt.cn
http://IFFV8lJ9.wfzLt.cn
http://Q0hCaAlr.wfzLt.cn
http://foQb2D3m.wfzLt.cn
http://ONNvY10I.wfzLt.cn
http://2jKozARM.wfzLt.cn
http://ajMSCqQo.wfzLt.cn
http://dfWCxaBO.wfzLt.cn
http://TMBkgJiL.wfzLt.cn
http://dgBY8CRA.wfzLt.cn
http://4yKjZ01T.wfzLt.cn
http://kR9aTyJR.wfzLt.cn
http://zYwOo1Gm.wfzLt.cn
http://wPakxQIF.wfzLt.cn
http://2NcKh7dt.wfzLt.cn
http://lzwiGsri.wfzLt.cn
http://LA5FhPqy.wfzLt.cn
http://5sx8f8UK.wfzLt.cn
http://iaaXb2XV.wfzLt.cn
http://8Q0f5z0N.wfzLt.cn
http://L62DGT1C.wfzLt.cn
http://zM2H19hs.wfzLt.cn
http://hsNWZAlo.wfzLt.cn
http://3VxH6TLM.wfzLt.cn
http://af9drezz.wfzLt.cn
http://M6w663XO.wfzLt.cn
http://ClDdThEY.wfzLt.cn
http://www.dtcms.com/a/228578.html

相关文章:

  • backend 服务尝试连接 qdrant 容器,但失败了,返回 502 Bad Gateway 问题排查
  • 为什么 uni-app 开发的 App 没有明显出现屏幕适配问题Flutter 开发的 App 出现了屏幕适配问题
  • 无人机避障——感知部分(Ubuntu 20.04 复现Vins Fusion跑数据集)胎教级教程
  • 网络安全厂商F5推出AI Gateway,化解大模型应用风险
  • 车载雷达:超声波雷达、毫米波雷达、激光雷达相关技术场景介绍和技术比较
  • 每日八股文6.3
  • 基于c++面向对象的设计(下)
  • 【AI论文】VF-Eval:评估多模态大型语言模型(MLLM)在生成人工智能生成内容(AIGC)视频反馈方面的能力
  • 【TMS570LC4357】之相关驱动开发学习记录2
  • C# Onnx 动漫人物人脸检测
  • 【设计模式-3.7】结构型——组合模式
  • 当 AI 超越人类:从技术突破到文明拐点的 2025-2030 年全景展望
  • 奥威BI+AI数据分析:企业数智化转型的加速器
  • Vue 渲染三剑客:createRenderer、h 和 render 详解
  • 工厂方法模式深度解析:从原理到应用实战
  • 使用ArcPy生成地图系列
  • win11中使用grep
  • 国产高性能pSRAM选型指南:CSS6404LS-LI 64Mb QSPI伪静态存储器
  • 【Visual Studio 2022】卸载安装,ASP.NET
  • VS下C++及C#项目打包发布方法
  • Cursor + Claude 4:微信小程序流量主变现开发实战案例
  • C++ 中的依赖注入(Dependency Injection)
  • 【论文阅读】Dolphin: Document Image Parsing via Heterogeneous Anchor Prompting
  • 菲尔斯特非接触测温技术的核心应用与选型指南
  • 网络安全问题及对策研究
  • 5分钟申请edu邮箱【方案本周有效】
  • Linux 与 Windows:哪个操作系统适合你?
  • 用 Vue 做一个轻量离线的“待办清单 + 情绪打卡”小工具
  • 计算A图片所有颜色占B图片红色区域的百分比
  • 简简单单探讨下starter