Skip to content

Commit

Permalink
Polish LambdaHttpHandler instances
Browse files Browse the repository at this point in the history
This came about while trying to reproduce the
problem mentioned in #21559
  • Loading branch information
geoand committed Nov 26, 2021
1 parent 2a132bf commit 972132a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class LambdaHttpHandler implements RequestHandler<APIGatewayV2HTTPEvent,

private static final int BUFFER_SIZE = 8096;

private static Headers errorHeaders = new Headers();
private static final Headers errorHeaders = new Headers();
static {
errorHeaders.putSingle("Content-Type", "application/json");
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public void handleMessage(Object msg) {
responseBuilder.setIsBase64Encoded(true);
responseBuilder.setBody(Base64.getEncoder().encodeToString(baos.toByteArray()));
} else {
responseBuilder.setBody(new String(baos.toByteArray(), StandardCharsets.UTF_8));
responseBuilder.setBody(baos.toString(StandardCharsets.UTF_8));
}
}
future.complete(responseBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class LambdaHttpHandler implements RequestHandler<AwsProxyRequest, AwsPro

private static final int BUFFER_SIZE = 8096;

private static Headers errorHeaders = new Headers();
private static final Headers errorHeaders = new Headers();
static {
errorHeaders.putSingle("Content-Type", "application/json");
}
Expand Down Expand Up @@ -126,7 +126,7 @@ public void handleMessage(Object msg) {
responseBuilder.setBase64Encoded(true);
responseBuilder.setBody(Base64.getEncoder().encodeToString(baos.toByteArray()));
} else {
responseBuilder.setBody(new String(baos.toByteArray(), StandardCharsets.UTF_8));
responseBuilder.setBody(baos.toString(StandardCharsets.UTF_8));
}
}
future.complete(responseBuilder);
Expand Down

0 comments on commit 972132a

Please sign in to comment.