The oficial docs don't mention how to configure RestClient to decompress a gzip response. By default it doesn't seem to decompress it like WebClient does.
It can be done by adding io.projectreactor.netty:reactor-netty:1.1.15
dependency and using ReactorNettyClientRequestFactory
as a request factory:
RestClient.builder()
.requestFactory(new ReactorNettyClientRequestFactory())
.build()
.get()
.uri(uri)
.retrieve()
.body(String.class);
Then gzip decompression is done automatically.