开发工具

Postman 传参-HTTP Status 400 - Req

2019-04-09  本文已影响0人  极简架构

使用Postman发送模拟请求的时候,Content-Type == application/x-www-form-urlencoded 可以接受到请求,而 Content-Type == application/json 的时候参数获取不到。并且会报错:HTTP Status 400 - Required String parameter ‘xx’ is not present

总结:

application/x-www-form-urlencoded请求是表单请求,可以用@RequestParam一个一个获取参数,当Content-Type == application/json 前端传来的是json串,用@RequestParam是获取不到的,需要用@RequestBody将json串华为对象

参考:

https://blog.csdn.net/Kindle_code/article/details/78442397

https://blog.csdn.net/qq_26761587/article/details/73691189

上一篇 下一篇

猜你喜欢

热点阅读