Skip to content

Commit f728dbc

Browse files
committed
Convert byte array to string for logging in ProxyResponse
1 parent 2416acd commit f728dbc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

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

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

2526
import static com.google.common.io.ByteStreams.toByteArray;
2627
import static java.util.Objects.requireNonNull;
@@ -38,7 +39,7 @@ public ProxyResponse handleException(Request request, Exception exception)
3839
public ProxyResponse handle(Request request, Response response)
3940
{
4041
try {
41-
return new ProxyResponse(response.getStatusCode(), response.getHeaders(), toByteArray(response.getInputStream()));
42+
return new ProxyResponse(response.getStatusCode(), response.getHeaders(), new String(toByteArray(response.getInputStream()), StandardCharsets.UTF_8));
4243
}
4344
catch (IOException e) {
4445
throw new ProxyException("Failed reading response from remote Trino server", e);
@@ -48,7 +49,7 @@ public ProxyResponse handle(Request request, Response response)
4849
public record ProxyResponse(
4950
int statusCode,
5051
ListMultimap<HeaderName, String> headers,
51-
byte[] body)
52+
String body)
5253
{
5354
public ProxyResponse
5455
{

0 commit comments

Comments
 (0)