I'm trying to send
headers.add("Accept-Encoding", "gzip");
in my Spring boot application.
I'm getting this Exception
com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens
But I need to send gzip as request header.
My Spring boot Version is '1.3.5.RELEASE'
Please help me out.
My Request Example:
url = apiUrl + apiMethod + "?api_key=" + apiKey;
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("api_key", apiKey);
headers.add("Content-Type", "application/json");
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
headers.set("Accept-Encoding", "x-gzip");
HttpEntity < String > entity = new HttpEntity < String > ("parameters", headers);
ResponseEntity < GenericResponseDto > response = null;
try {
response = restTemplate.exchange(url, HttpMethod.GET, entity,
GenericResponseDto.class);
log.info("Response :" + response.toString());
} catch (Exception e) {
throw new CustomException(e, aPIAuditTrail);
}