POST方法应沿着HTTP请求对象发送。并且该请求可以包含HTTP标头或HTTP正文或两者。
因此,让我们创建一个HTTP实体,并在正文中发送标头和参数。
HttpHeaders headers = new HttpHeaders();headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);MultiValueMap<String, String> map= new linkedMultiValueMap<String, String>();map.add("email", "first.last@example.com");HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(map, headers);ResponseEntity<String> response = restTemplate.postForEntity( url, request , String.class );


