2121import io .trino .gateway .proxyserver .ProxyResponseHandler .ProxyResponse ;
2222
2323import java .io .IOException ;
24+ import java .io .InputStream ;
25+ import java .nio .charset .Charset ;
26+ import java .nio .charset .StandardCharsets ;
2427
25- import static com .google .common .io .ByteStreams .toByteArray ;
2628import static java .util .Objects .requireNonNull ;
29+ import static org .openjdk .jol .util .IOUtils .readAllBytes ;
2730
2831public class ProxyResponseHandler
2932 implements ResponseHandler <ProxyResponse , RuntimeException >
@@ -38,7 +41,7 @@ public ProxyResponse handleException(Request request, Exception exception)
3841 public ProxyResponse handle (Request request , Response response )
3942 {
4043 try {
41- return new ProxyResponse (response .getStatusCode (), response .getHeaders (), toByteArray (response .getInputStream ()));
44+ return new ProxyResponse (response .getStatusCode (), response .getHeaders (), new String (response .getInputStream (). readAllBytes (), Charset . defaultCharset ()));
4245 }
4346 catch (IOException e ) {
4447 throw new ProxyException ("Failed reading response from remote Trino server" , e );
@@ -48,7 +51,7 @@ public ProxyResponse handle(Request request, Response response)
4851 public record ProxyResponse (
4952 int statusCode ,
5053 ListMultimap <HeaderName , String > headers ,
51- byte [] body )
54+ String body )
5255 {
5356 public ProxyResponse
5457 {
0 commit comments