From b17f842de7d1c743c2f953152a34ec8fdf58f0ff Mon Sep 17 00:00:00 2001 From: Dan Morphis Date: Tue, 14 Oct 2014 10:28:23 -0800 Subject: [PATCH] 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 b2ca3ce..c1f5bf9 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?