Skip to content

Commit 601ef5b

Browse files
committed
Convert byte array to string for logging in ProxyResponse
1 parent 531929a commit 601ef5b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gateway-ha/src/main/java/io/trino/gateway/proxyserver/ProxyResponseHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import io.trino.gateway.proxyserver.ProxyResponseHandler.ProxyResponse;
2222

2323
import java.io.IOException;
24+
import java.nio.charset.Charset;
2425

25-
import static com.google.common.io.ByteStreams.toByteArray;
2626
import static java.util.Objects.requireNonNull;
2727

2828
public class ProxyResponseHandler
@@ -38,7 +38,7 @@ public ProxyResponse handleException(Request request, Exception exception)
3838
public ProxyResponse handle(Request request, Response response)
3939
{
4040
try {
41-
return new ProxyResponse(response.getStatusCode(), response.getHeaders(), toByteArray(response.getInputStream()));
41+
return new ProxyResponse(response.getStatusCode(), response.getHeaders(), new String(response.getInputStream().readAllBytes(), Charset.defaultCharset()));
4242
}
4343
catch (IOException e) {
4444
throw new ProxyException("Failed reading response from remote Trino server", e);
@@ -48,7 +48,7 @@ public ProxyResponse handle(Request request, Response response)
4848
public record ProxyResponse(
4949
int statusCode,
5050
ListMultimap<HeaderName, String> headers,
51-
byte[] body)
51+
String body)
5252
{
5353
public ProxyResponse
5454
{

0 commit comments

Comments
 (0)