Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit 3d6aa30

Browse files
committed
eliminate weird empty body check
1 parent b4f10c9 commit 3d6aa30

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/utils/serve-functions.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,13 @@ function createHandler(dir) {
177177
var isBase64Encoded = false;
178178
var body = request.body;
179179

180-
if (body === undefined || Object.keys(body).length === 0) {
181-
// handle empty body (https://github.com/expressjs/body-parser/issues/288)
182-
body = "";
183-
} else if (body instanceof Buffer) {
180+
if (body instanceof Buffer) {
184181
isBase64Encoded = true;
185182
body = body.toString("base64");
186183
} else if(typeof(body) === "string") {
187184
// body is already processed as string
185+
} else {
186+
body = "";
188187
}
189188

190189
const lambdaRequest = {

0 commit comments

Comments
 (0)