I’m working on a project where I want to send analog values to a third party server. With httpresponse.headers and httpresponse.send I’m able to have my agent send a JSON containing my data to my node server, however it’s not in the format I would like. The object my server gets looks like this:
The problem is that I don’t know how to place my data ‘voltage’ within the data object. As you can see httpresponse.headersI can place it within headers, as well as, httpresponse.send within content.
Thanks @beardedinventer! I got very frustrated with this project so I took a break but I just got back to it and your post definitely got me in the right direction!
All I had to do was add { “content-type”: “application/json” }; to my header and all was well
Many servers ignore the “content-type” header, but many require it - it’s generally a good idea to include… and probably something we should include in some more of our documentation