From e38bf0b0e0060d5f6cf53f39565d42f998769b4e Mon Sep 17 00:00:00 2001 From: Dan Morphis Date: Tue, 14 Oct 2014 10:28:04 -0800 Subject: [PATCH 1/2] Fix misspelling --- lib/tasks.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks.coffee b/lib/tasks.coffee index cfe2ddf..1379bf0 100644 --- a/lib/tasks.coffee +++ b/lib/tasks.coffee @@ -76,7 +76,7 @@ this.refreshObject = (task, methodResponse, callback) -> delete task.session.parameterNames this.getParameterValues(task.session.subtask, {}, (err, status, methodRequest) -> - # ignore deviceUpdates returned by firt call to getParameterValues + # ignore deviceUpdates returned by first call to getParameterValues callback(err, status, methodRequest, deviceUpdates) ) else if status & STATUS_OK From 612bc8e414d4d4b7c973c4172035a591fba4387e Mon Sep 17 00:00:00 2001 From: Dan Morphis Date: Tue, 14 Oct 2014 10:28:23 -0800 Subject: [PATCH 2/2] Return the task object when adding a task --- lib/nbi.coffee | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/nbi.coffee b/lib/nbi.coffee index c7490aa..8421431 100644 --- a/lib/nbi.coffee +++ b/lib/nbi.coffee @@ -196,21 +196,21 @@ listener = (request, response) -> if urlParts.query.connection_request? apiFunctions.connectionRequest(deviceId, (err) -> if err - response.writeHead(202) - response.end() + response.writeHead(202, {'Content-Type' : 'application/json'}) + response.end(JSON.stringify(task)) else apiFunctions.watchTask(task._id, config.get('DEVICE_ONLINE_THRESHOLD', deviceId), (err) -> if err - response.writeHead(202) - response.end() + response.writeHead(202, {'Content-Type' : 'application/json'}) + response.end(JSON.stringify(task)) return - response.writeHead(200) - response.end() + response.writeHead(200, {'Content-Type' : 'application/json'}) + response.end(JSON.stringify(task)) ) ) else - response.writeHead(202) - response.end() + response.writeHead(202, {'Content-Type' : 'application/json'}) + response.end(JSON.stringify(task)) ) ) else if urlParts.query.connection_request?