Skip to content

Commit

Permalink
Merge pull request #114 from danew/fix/optional-body
Browse files Browse the repository at this point in the history
Allow reponse body to be optional
  • Loading branch information
swyxio authored Feb 3, 2019
2 parents f22e699 + 4bdcfcd commit 2545e8f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ function createCallback(response) {
for (const key in lambdaResponse.headers) {
response.setHeader(key, lambdaResponse.headers[key]);
}
response.write(
lambdaResponse.isBase64Encoded
? Buffer.from(lambdaResponse.body, "base64")
: lambdaResponse.body
);

if (lambdaResponse.body) {
response.write(
lambdaResponse.isBase64Encoded
? Buffer.from(lambdaResponse.body, "base64")
: lambdaResponse.body
);
}
response.end();
}
}
Expand Down

0 comments on commit 2545e8f

Please sign in to comment.