node-red-contrib-ibmpush
Advanced tools
Comparing version
/** | ||
* Copyright 2014 IBM Corp. | ||
* Copyright 2014, 2015 IBM Corp. | ||
* | ||
@@ -21,5 +21,3 @@ * Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
var ibmpush = require('ibmpush'); | ||
var querystring = require("querystring"); | ||
var isVCapEnv = process.env.VCAP_APPLICATION ? true:false; | ||
@@ -55,21 +53,13 @@ | ||
RED.httpAdmin.post('/ibmpush/:id', function(req,res) { | ||
var body = ""; | ||
var newCreds = req.body; | ||
var credentials = RED.nodes.getCredentials(req.params.id) || {}; | ||
req.on('data', function(chunk) { | ||
body += chunk; | ||
}); | ||
if (newCreds.password == "") { | ||
delete credentials.password; | ||
} else { | ||
credentials.password = newCreds.password || credentials.password; | ||
} | ||
req.on('end', function() { | ||
var newCreds = querystring.parse(body); | ||
var credentials = RED.nodes.getCredentials(req.params.id) || {}; | ||
if (newCreds.password == "") { | ||
delete credentials.password; | ||
} else { | ||
credentials.password = newCreds.password || credentials.password; | ||
} | ||
RED.nodes.addCredentials(req.params.id, credentials); | ||
res.send(200); | ||
}); | ||
RED.nodes.addCredentials(req.params.id, credentials); | ||
res.send(200); | ||
}); | ||
@@ -76,0 +66,0 @@ |
{ | ||
"name": "node-red-contrib-ibmpush", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"license": "Apache", | ||
@@ -5,0 +5,0 @@ "repository" : { |
Sorry, the diff of this file is not supported yet
35467
0.53%170
-3.95%