fixed send json
Cheers for the contribution @furlan97, what is the purpose for these explicit sets?
res.send(completeJSON) should suffice the header set. Please let me know otherwise.
Hi @andrewshatnyy, also res.json(completeJSON) would be great, however for me it's not working, i've got this error:
{"name":"svc-agent-reader","hostname":"host-1","pid":35692,"level":50,"msg":"sent error res.send is not a function to the cloud","time":"2017-09-07T06:57:14.885Z","v":0} {"name":"svc-agent-reader","hostname":"host-1","pid":35692,"level":50,"err":{"message":"res.send is not a function","name":"TypeError","stack":"TypeError: res.send is not a function\n at giveResponse (/Users/user1/Desktop/mtconnect-agent/src/utils/handlers.js:154:11)\n at Object.current (/Users/user1/Desktop/mtconnect-agent/src/routes/current.js:52:12)\n at current.next (<anonymous>)\n at Object.dispatch (/Users/user1/Desktop/mtconnect-agent/node_modules/koa-router/lib/router.js:334:12)\n at dispatch.next (<anonymous>)\n at onFulfilled (/Users/user1/Desktop/mtconnect-agent/node_modules/co/index.js:65:19)\n at /Users/user1/Desktop/mtconnect-agent/node_modules/co/index.js:54:5\n at Promise (<anonymous>)\n at Object.co (/Users/user1/Desktop/mtconnect-agent/node_modules/co/index.js:50:10)\n at Object.toPromise (/Users/user1/Desktop/mtconnect-agent/node_modules/co/index.js:118:63)"},"msg":"res.send is not a function","time":"2017-09-07T06:57:14.886Z","v":0}
I'm using node v8.4.0.
Will defer to @dskurbatov on this one. Cheers.