使用出curl发送body时,需要加header -H 'Content-Type: application/json' ,否则content type就是application/x-www-form-urlencoded,那么这时候@RequestBody是接收不到的,而是@ModelAttribute 才能接收。
curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/test/adduser
使用curl发送 POST JSON
最新推荐文章于 2025-03-05 10:50:10 发布