How to remove Transfer-Encoding: chunking from a @RestController response?

  Kiến thức lập trình

I am writing a Spring Boot app that exposes a REST JSON API; however, some older clients cannot parse the JSON response because these numbers are present at the start and end of the response body:

Numbers

After a lot of searching and testing, I have come to the conclusion that those numbers are caused by Transfer-Encoding: chunking.

I have tried setting the Transfer-Encoding header manually, however it just gets ignored.

LEAVE A COMMENT