0

I have one get api that I'm calling internally in spring boot using RestTemplate. Everything is working fine except,

If the response size is less then 10kb, there is no issue.

But if the response size is greater then 10kb, RestTemplate is throwing exception with "500 Internal server error".

Same request is working fine in postman.

So the question is, Is there any configuration to specify response size in RestTemplate? how can i increase the response size in RestTemplate?

Pirate
  • 2,886
  • 4
  • 24
  • 42
  • I would suppose some automatically added headers in postman make the backend you are calling work with bigger responses. I suggest you look at the full postman request (e.g. looking at the curl command or whatever way to see the automatic headers), compare this with the full header list in the rest template call and then attempt to augment the `RestTemplate` headers with the differences. The issue happens in the called server due to the instructions you give in your request, thus I expect this will fix your problem – Boris Strandjev Jan 21 '22 at 09:06
  • The header passed from postman, i have try to remove those header, but i'm not getting 500 internal error instead 400 bad request. – Pirate Jan 21 '22 at 11:44
  • rather than removing all headers, try one by one. Further, my suggestion was adding headers to `RestTemplate` so that, hopefully, you get to positive result, rather than removing from postman and thus getting negative :) – Boris Strandjev Jan 21 '22 at 13:30

0 Answers0