我想使用邮递员测试我的控制器,但不知道如何使用邮递员发送模型属性。我什至不知道是否可能。
我的控制器似乎是:
@Controller
@RequestMapping(path = "/api/v1")
public class PaymentController {
@Autowired
private CredentialsRepository credentialsRepository;
@PostMapping(path = "/charge")
public String charge(@ModelAttribute("pay-load") PayLoad payLoad, Model model) {
Credentials creds = credentialsRepository.findCredentialsById(1);
if (creds == null)
return "init_credentials";
return "charge";
}
}
模型属性
public class PayLoad {
private Integer mId;
private Integer ordId;
private Integer cardId;
private Integer cvvNo;
private String hash;
// getter & setter
}