Getting Response too large exception when executing rest api POST using RestTemplate SpringBoot

178 Views Asked by At

I am getting Response too large when executing exchange (type POST) method from Spring Boot restTemplate. Below is the output

{"errors":[{"message":"Response too large","extensions":{"code":"413","responseSizeKb":1901.147,"responseSizeMaxKb":1000}}]}

I need to increase response size. Not sure how to do that.

Below are the code and httpHeaders

ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, this.getHttpEntity(), String.class, new Object[0]);


headers.add(Authorization, TOKEN_TYPE_BEARER + authKey);
headers.add(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
headers.setAccept(Arrays.asList(MediaType.ALL));
headers.add("Connection", "keep-alive");
headers.add("Cache-Control", "no-cache");

I tried to increase content-length but no luck

headers.add(HttpHeaders.CONTENT_LENGTH, "179974");

Can anyone please help me to increase response size ?

0

There are 0 best solutions below