Reputation: 7080
I'm making simple http service with Spring Boot RestController, and what I was found, when I try to request via GET Json object I didn't get content-length in header and transfer-encoding becomes chunked.
With simple ResponseEntit<String>
all headers set as expected.
What kind of problem may lead to this behavior?
Upvotes: 5
Views: 8466
Reputation: 2085
Ths is not a problem, Transfer-encoding chuncked
and no content length means that response was compressed. If compression is enabled in Spring boot it will compress responses larger than certain amount (2048 bytes by default). I think your ResponseEntit<String>
is simply smaller than required for compression.
You can read more about compression settings in documentation.
If you want consistency you can either disable compressing, or set server.compression.min-response-size
to a very small value. But I would suggest to keep it as is.
Upvotes: 4