美文网首页开发工具
Postman 传参-HTTP Status 400 - Req

Postman 传参-HTTP Status 400 - Req

作者: 极简架构 | 来源:发表于2019-04-09 22:23 被阅读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

相关文章

网友评论

    本文标题:Postman 传参-HTTP Status 400 - Req

    本文链接:https://www.haomeiwen.com/subject/kipwiqtx.html