update Node.js to version 10 (#171)
diff --git a/Dockerfile b/Dockerfile
index 9699608..51525bc 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 8ec79a9..902c9d9 100644
--- a/provider/lib/authHandler.js
+++ b/provider/lib/authHandler.js
@@ -1,14 +1,14 @@
// Licensed to the Apache Software Foundation (ASF) under one or more contributor
// license agreements; and to You under the Apache License, Version 2.0.
-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 d70881b..6dde7ef 100644
--- a/provider/lib/utils.js
+++ b/provider/lib/utils.js
@@ -100,13 +100,7 @@
json: triggerData.payload
}, 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;
var triggerIdentifier = triggerData.triggerID;
logger.info(method, triggerIdentifier, 'http post request, STATUS:', statusCode);
@@ -508,10 +502,9 @@
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);