This is an automated email from the ASF dual-hosted git repository.

dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-package-alarms.git


The following commit(s) were added to refs/heads/master by this push:
     new 11954a8  Apply needle client (#205)
11954a8 is described below

commit 11954a81647e1e41943be7c15763ffd6626d326d
Author: 김건희 <[email protected]>
AuthorDate: Tue Feb 18 22:12:51 2020 +0900

    Apply needle client (#205)
    
    * Add required dependencies
    * Apply needle module instead of request
---
 action/alarmFeed_package.json |  6 +++++-
 action/alarmWeb_package.json  |  5 ++++-
 action/lib/common.js          | 16 ++++------------
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/action/alarmFeed_package.json b/action/alarmFeed_package.json
index 8ae9040..dd54326 100644
--- a/action/alarmFeed_package.json
+++ b/action/alarmFeed_package.json
@@ -1,5 +1,9 @@
 {
   "name": "alarmFeed",
   "version": "1.0.0",
-  "main": "alarm.js"
+  "main": "alarm.js",
+  "dependencies" : {
+    "nano": "8.1.0",
+    "needle": "2.3.2"
+  }
 }
diff --git a/action/alarmWeb_package.json b/action/alarmWeb_package.json
index dfda12e..6e1f4b5 100644
--- a/action/alarmWeb_package.json
+++ b/action/alarmWeb_package.json
@@ -3,6 +3,9 @@
   "version": "1.0.0",
   "main": "alarmWebAction.js",
   "dependencies" : {
-    "cron": "1.7.0"
+    "cron": "1.7.0",
+    "needle": "2.3.2",
+    "nano": "8.1.0",
+    "moment": "2.24.0"
   }
 }
diff --git a/action/lib/common.js b/action/lib/common.js
index 23046df..0f74130 100644
--- a/action/lib/common.js
+++ b/action/lib/common.js
@@ -15,28 +15,20 @@
  * limitations under the License.
  */
 
-const request = require('request');
+const needle = require('needle');
 const openwhisk = require('openwhisk');
 const config = require('./config');
 
 function requestHelper(url, input, method) {
-
     return new Promise(function(resolve, reject) {
 
-        var options = {
-            method : method,
-            url : url,
+        const options = {
             json: true,
             rejectUnauthorized: false
         };
 
-        if (method === 'get') {
-            options.qs = input;
-        } else {
-            options.body = input;
-        }
-
-        request(options, function(error, response, body) {
+        // needle takes e.g. 'put' not 'PUT'
+        needle.request(method.toLowerCase(), url, input, options, 
function(error, response, body) {
 
             if (!error && response.statusCode === 200) {
                 resolve(body);

Reply via email to