I'm studying node.js and trying to implement the following task:
I have to get connection to existing https - for this purpose I decided to choose needle module:
needle.post('https://...', data, options, function (err, res, body){ });
I need to send a request to server as json object using these parameters:
{"action": "AuthenticationManagement", "method":"login", "data": [null, null], "type": "rpc", "tid": 1}
As I understand it, these parameters should be sent in terms of data
within needle.post
.
In case I have connected to the server, I need to get cookies from it (sessionID
parameter, etc) and save it to file/keep it in memory
during my further operations with server. Looks like, cookies should be sent back in res.headers
.
Any help will be much appreciated.
Needle
does not support cookies yet. I 'd suggest using a different library rather than rolling your own implementation over needle
.