Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
Fix empty body for NodeJS functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres committed Mar 20, 2018
1 parent 0215d4f commit 8724ad3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docker/runtime/nodejs/kubeless.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ function modExecute(handler, req, res, end) {
'event-id': req.get('event-id'),
'event-time': req.get('event-time'),
'event-namespace': req.get('event-namespace'),
'data': (req.get('content-type') === 'application/json') ? JSON.parse(req.body.toString('utf-8')) : req.body.toString('utf-8'),
'data': (req.get('content-type') === 'application/json' && req.body.length > 0)
? JSON.parse(req.body.toString('utf-8'))
: req.body.toString('utf-8'),
'extensions': { request: req },
};
Promise.resolve(func(event, context))
Expand Down
4 changes: 2 additions & 2 deletions kubeless.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ local runtime_images ='[
{
"name": "node6",
"version": "6",
"runtimeImage": "kubeless/nodejs@sha256:37d496adee0896a4a192f7116d8075ae88ee14b1a3c41974d79609e0863ae464",
"runtimeImage": "kubeless/nodejs@sha256:12a767ba23a54daad0c187bc192d97371df863e8ccc6438ad60d81c9acd84309",
"initImage": "node:6.10"
},
{
"name": "node8",
"version": "8",
"runtimeImage": "kubeless/nodejs@sha256:4327d0f7781463a8b0a843000592c2c0df17988662b38b33dbb35b1bdd5ccc2b",
"runtimeImage": "kubeless/nodejs@sha256:1544aab7a31dab207882a6e7214465400bf3d26838d8a7ac631e74b87aeff006",
"initImage": "node:8"
}
],
Expand Down

0 comments on commit 8724ad3

Please sign in to comment.