This is an automated email from the ASF dual-hosted git repository. csantanapr pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-cloudant.git
The following commit(s) were added to refs/heads/master by this push: new cc9f351 update Node.js to version 10 (#189) cc9f351 is described below commit cc9f35151b7b471f74e7f032c1f3342168687ca2 Author: Jason Peterson <jason...@us.ibm.com> AuthorDate: Wed Dec 12 13:36:10 2018 -0500 update Node.js to version 10 (#189) --- Dockerfile | 2 +- provider/lib/authHandler.js | 8 ++++---- provider/lib/utils.js | 15 ++++----------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9a4c6d7..57f8728 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:8.14.0 +FROM node:10.14.0 # only package.json ADD package.json / diff --git a/provider/lib/authHandler.js b/provider/lib/authHandler.js index 9e25242..5c6be15 100644 --- a/provider/lib/authHandler.js +++ b/provider/lib/authHandler.js @@ -1,11 +1,11 @@ -function handleAuth(triggerData) { +function handleAuth(triggerData, options) { var auth = triggerData.apikey.split(':'); - return Promise.resolve({ + options.auth = { user: auth[0], pass: auth[1] - }); - + }; + return Promise.resolve(options); } module.exports = { diff --git a/provider/lib/utils.js b/provider/lib/utils.js index c863d74..214c6e5 100644 --- a/provider/lib/utils.js +++ b/provider/lib/utils.js @@ -242,13 +242,7 @@ module.exports = function(logger, triggerDB, redisClient) { json: form }, function(error, response) { try { - var statusCode; - if (!error) { - statusCode = response.statusCode; - } - else if (error.statusCode) { - statusCode = error.statusCode; - } + var statusCode = !error ? response.statusCode : error.statusCode; logger.info(method, triggerData.id, 'http post request, STATUS:', statusCode); if (error || statusCode >= 400) { // only manage trigger fires if they are not infinite @@ -512,10 +506,9 @@ module.exports = function(logger, triggerDB, redisClient) { this.authRequest = function(triggerData, options, cb) { var method = 'authRequest'; - authHandler.handleAuth(triggerData) - .then(auth => { - options.auth = auth; - request(options, cb); + authHandler.handleAuth(triggerData, options) + .then(requestOptions => { + request(requestOptions, cb); }) .catch(err => { logger.error(method, err);