Dum*_*nga 7 java spring spring-mvc
我想在 post 映射中发送路径变量,在 postman 软件中。我选择了 post 映射正文,然后怎么办?我检查了@RequestParam vs @PathVariable示例,get 方法的所有答案,但我需要 post 方法的答案。
@RestController
@RequestMapping("api/v1/customers")
public class CustomerController {
@PostMapping("/{code}")
public String postRequest(@PathVariable String code,@RequestBody CustomerDTO dto){
System.out.println(dto);
System.out.println(code);
return "Something";
}
}
Run Code Online (Sandbox Code Playgroud)
小智 9
选择 post -> 添加 url -> 选择 body -> 选择 raw -> 选择 JSON(application/json) -> 添加你的 json 数据 -> 点击发送
小智 9
在邮递员中放置路径变量的简单方法是您的情况是“/:code”

| 归档时间: |
|
| 查看次数: |
31550 次 |
| 最近记录: |