I am having @RestController
with endpoint like below (spring-boot version 1.5.9.RELEASE)
@RestController
public class Controller
{
@PostMapping(value = "profile", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Profile profile(@RequestBody Request request) {
... ... ...
return profileObj;
}
}
Whenever I invoke above endpoint, I am getting response with below headers,
.... ... ...
Access-Control-Allow-Headers:
Cache-Control: no cache, no-store, must-revalidate
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
I want to disable transfer-encoding, i.e, I need to include content-length.
I have many controllers like this. So I don't want to calculate length in each endpoint and return ResponseEntity
with length value. I am looking for generic solution which will automatically include content-length. Is there anyway to achieve this?