'How to expose header information in API response message?

I'm using spring's responseEntity response.

The response I've been using so far is return ResponseEntity.status(200).body(...); method, in this case the return data is in the form [ { ...}, {...} ].

Then, I checked the example, and there was a response header in front of this [ { ...}, {...} ].

HTTP/1.1 200
Content-Type: application/json;
charset=UTF-8 Transfer-Encoding: chunked
Date: Sun, 07 Oct 2018 11:53:46 GMT

[{"id":1,"username":"Jane"},{"id":2,"username":"John"}]

like this

Instead of checking the header separately, I want to check it together in the response message like this.

Did I misunderstand that the header message was arbitrarily moved?

Or is it possible?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source