![](/img/trans.png)
[英]Can not send POST variables to php script on localhost using Postman
[英]can not send a post request using postman
我正在嘗試使用郵遞員發送請求。 由於某種原因,我收到400錯誤的請求-缺少所需的請求正文。 我的控制器處於春季啟動環境中。
我的控制器:
@RestController
public class HagarController {
@PostMapping(value = "/hagar")
@ResponseStatus(HttpStatus.OK)
public void hagar(@RequestBody String name, @RequestBody String id)
throws Exception{
System.out.println("my name is: " + name +" id: " + id);
}
}
謝謝!!
這是我的操作方式,希望對您有所幫助:
@RestController
public class HagarController {
@ResponseMapping(value = "/add", method = RequestMethod.POST)
public void hagar(@RequestBody String name, @RequestBody String id)
System.out.println("my name is: " + name +" id: " + id);
}
在郵遞員中,您可能已在標題中添加了: 查看圖片 : 在此處輸入圖片說明
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.