I am not a permanent user of NODE-RED, I am more using CURL and JQ ...
NOW, I have a small project where the LOGIN of a webserver is returning 3 cookies named
JSESSION ID
CatchMe
SID-TOKEN
.
In the flows, using a function block, I can get to the cookie values e.g. with
var myCookie1= msg.responseCookies.CatchMe; <=== is working
var myCookie2= msg.responseCookies.SID-TOKEN; <=== is not working, producing an error message
It works well except with the cookie SID-TOKEN, where the function block is interpreting the cookie-name as a formula, missing TOKEN then and throws an error message.
Here, I am struggling with a solution. I have the feeling that the problem can be solved within the function-block or with a change block, but I am, too blind to see it ...
I of course could send the msg through exec to a shell, do the manipulation there, and collecting the changed msg back, but that's quite a workaround ...
Here is a complete message ... I tried also some JSONata code, but did not succeed either ... If I only knew how to convert the whole msg into a simple string, work on that in a function and then put it back into a JSON msg ...
As you can see, I was playing a little with different code, the initial
var myCookie2= msg.responseCookies.SID-TOKEN;
is not working either.
If I am not able to extract that cookie for further usage, then it is not worth to continue with NODE-RED and I will better go back to curl and pq in scripting ...
Note that there is quite extensive documentation available for node-red. As a beginner I would recommend to use as little function nodes as possible, many things can be done with the change and switch nodes.
Yes, there is a lot of docs and also some books, which are laying here beside me. This is the frst trial under Windows of NODE-RED at me and with http... I did more than a handful of flows under small Linux boxes mainly with typical PLC protocols like MODBUS, Siemens S7 and OPC/UA along with some Arduino type micros or older legacy serial comms HVAC equipment. That was never a problem...
This time, I need to run it on Windows, because there is a Window-only application what needs to be connected to PLC systems and where no interface is included or even supported...