使用curl发送值

时间:2019-04-21 07:40:39

标签: curl postman

我有这个POSTMAN配置,用于将值发送到Spring端点:

enter image description here

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发送相同的数据?

1 个答案:

答案 0 :(得分:1)

使用邮递员的代码按钮并选择cURL: enter image description here

enter image description here