1 简单的GET请求
curl 网址 默认发送GET请求
curl www.baidu.com
2 POST请求携带路径参数
curl -XPOST 192.168.67.1:9966/hello/JACK
3 POST请求携带JSON参数
curl -XPOST 192.168.67.1:9966/hello2 --header "Content-Type: application/json" -d '{"name":"张三","age":18}'
两个测试接口
@PostMapping("/hello/{name}")
public String getPostMapping(@PathVariable("name") String name){
return name;
}
@PostMapping("/hello2")
public Person getPostMapping2(@RequestBody Person person){
return person;
}