GH-574 Fix String wrapping for input/output for AWS APIGateway

As suggested by the user we were improperly wrapping the String payload for input/output during APIGateway interaction

Resolves #574
This commit is contained in:
Oleg Zhurakousky
2020-08-06 16:01:12 +02:00
parent 9e9467fac0
commit 21e49aa8e2
2 changed files with 7 additions and 7 deletions

View File

@@ -100,7 +100,7 @@ public class FunctionInvoker implements RequestStreamHandler {
response.put("statusDescription", httpStatus.toString());
}
String body = new String(responseMessage.getPayload(), StandardCharsets.UTF_8).replaceAll("\"", "");
String body = new String(responseMessage.getPayload(), StandardCharsets.UTF_8).replaceAll("\\\"", "\"");
response.put("body", body);
Map<String, String> responseHeaders = new HashMap<>();
@@ -193,7 +193,7 @@ public class FunctionInvoker implements RequestStreamHandler {
}
else {
Object body = requestMap.remove("body");
body = body instanceof String ? ("\"" + body + "\"").getBytes(StandardCharsets.UTF_8) : mapper.writeValueAsBytes(body);
body = body instanceof String ? String.valueOf(body).getBytes(StandardCharsets.UTF_8) : mapper.writeValueAsBytes(body);
messageBuilder = MessageBuilder.withPayload(body).copyHeaders(requestMap);
}
}