How in java, can I send a request with x-www-form-urlencoded header
. I don\
For HttpEntity
, the below answer works
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap map= new LinkedMultiValueMap();
map.add("email", "first.last@example.com");
HttpEntity> request = new HttpEntity>(map, headers);
ResponseEntity response = restTemplate.postForEntity( url, request , String.class );
For reference: How to POST form data with Spring RestTemplate?