我有这个POSTMAN配置,用于将值发送到Spring端点:
Spring端点:
@PostMapping(consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, value = "/v1/notification")
public ResponseEntity<String> handleNotifications(@RequestBody MultiValueMap<String, Object> keyValuePairs) {
LOGGER.debug("handleFormMessage");
LOGGER.debug("keyValuePairs: {}", keyValuePairs);
String unique_id = String.valueOf(keyValuePairs.get("uniqueid"));
String status = String.valueOf(keyValuePairs.get("status"));
String external_id = String.valueOf(keyValuePairs.get("external_id"));
String gateway = String.valueOf(keyValuePairs.get("gateway"));
String transaction_type = String.valueOf(keyValuePairs.get("transaction_type"));
try {
System.out.println("!!!!!");
System.out.println("!!!! unique_id " + unique_id);
System.out.println("!!!!! Entered if(paymentTransaction.isPresent()) {");
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity<>("Please contact technical support!", HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<>(HttpStatus.OK);
}
是否可以通过curl发送相同的数据?