mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
fix(lambda): parse empty payload in lambda (#600)
This commit is contained in:
1 parent
5f94b429c2
commit
1b119faf0d
2 files changed
+34
-3
No files matched your search
+5
-3
@@ -90,15 +90,17 @@ public class RuntimeApiServer {
|
||||
return;
|
||||
}
|
||||
inFlight.put(invocation.getRequestId(), invocation);
|
||||
byte[] payload = invocation.getPayload();
|
||||
String body = (payload != null && payload.length > 0)
|
||||
? new String(payload)
|
||||
: "{}";
|
||||
ctx.response()
|
||||
.setStatusCode(200)
|
||||
.putHeader("Content-Type", "application/json")
|
||||
.putHeader("Lambda-Runtime-Aws-Request-Id", invocation.getRequestId())
|
||||
.putHeader("Lambda-Runtime-Invoked-Function-Arn", invocation.getFunctionArn())
|
||||
.putHeader("Lambda-Runtime-Deadline-Ms", String.valueOf(invocation.getDeadlineMs()))
|
||||
.end(invocation.getPayload() != null
|
||||
? new String(invocation.getPayload())
|
||||
: "{}");
|
||||
.end(body);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
ctx.response().setStatusCode(204).end();
|
||||
|
||||
Reference in new issue
Block a user