【异常】postman能够请求成功获取到参数,前端请求的却请求不到

1 前端联调的时候,反馈自己的参数没有生效,无论传递任何参数都是一样的结果

盯了一下日志发现

postman请求的是   :{"getParameter":{"provinceCode":["11"],"cityCode":["00"],"chargingType":["1"],"date":["1566835200000"]},"method":"POST","postParameter":"","requestURI":"//charging/heat/map/station/count","requestUUID":"3cc9c870938444429942a0c490f9756a”}

前端请求的是:

[请求拦截日志信息]:{"getParameter":{},"method":"POST","postParameter":"{"date":"","cityCode":"00","provinceCode":"11","chargingType":"","operator":"","t":1567132526495}","requestURI":"//charging/heat/map/station/count","requestUUID":"05b9828002d94091b0f00a322e78a2e5"}

2 发现了区别 一个是类似数组,一个是json串

原来自己后端接口写的是form表单提交,postman请求的就是表单提交,但是前端请求是body中嵌套json请求的

3 修改一下Controller

加上  @RequestBody注解,支持json方式提交参数解决问题

原文地址:https://www.cnblogs.com/QuestionsZhang/p/11433816.html