其他分享
首页 > 其他分享> > post json数据到接口

post json数据到接口

作者:互联网

请求:

 1 curl -X POST "http://localhost:8080/hello2" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"username\": \"test\"}" 

 

接口:

1 @PostMapping("/hello2")
2     public String hello2(@RequestBody Map<String,String> data){
3         System.out.println(data.getClass());
4         return "hello "+data.get("username");
5     }

 

标签:username,getClass,data,接口,json,post,hello2
来源: https://www.cnblogs.com/xianzaikaishi/p/15635801.html