[{"id":"26bab905.7b6886","type":"comment","z":"f8c76b6e.7d9bc8","name":"GET and POST","info":"","x":110,"y":40,"wires":[]},{"id":"17b87124.b78bdf","type":"http request","z":"f8c76b6e.7d9bc8","name":"","method":"use","ret":"obj","url":"","tls":"","x":530,"y":120,"wires":[["148c676f.d62d89","b53d4941.5e5408"]]},{"id":"93905d57.277b8","type":"inject","z":"f8c76b6e.7d9bc8","name":"Logged In?","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":150,"y":120,"wires":[["6e76a238.0c386c"]]},{"id":"c719c310.3a695","type":"inject","z":"f8c76b6e.7d9bc8","name":"Login","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":130,"y":180,"wires":[["95a4e1b9.bfa54"]]},{"id":"148c676f.d62d89","type":"debug","z":"f8c76b6e.7d9bc8","name":"","active":true,"console":"false","complete":"false","x":730,"y":120,"wires":[]},{"id":"6e76a238.0c386c","type":"function","z":"f8c76b6e.7d9bc8","name":"Get Payload","func":"msg.url = \"http://10.23.59.254/api/auth/loggedin\";\nmsg.headers = {\"user-agent\": \"node-red\"};\nmsg.method = \"GET\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":120,"wires":[["17b87124.b78bdf"]]},{"id":"95a4e1b9.bfa54","type":"function","z":"f8c76b6e.7d9bc8","name":"POST Payload","func":"msg.url = \"http://10.23.59.254/api/auth/login\";\nmsg.headers = {\"user-agent\": \"node-red\"};\nmsg.method = \"POST\";\nmsg.payload = {\"username\":\"XXX\",\"password\":\"XXX\"};\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":180,"wires":[["17b87124.b78bdf"]]},{"id":"b53d4941.5e5408","type":"debug","z":"f8c76b6e.7d9bc8","name":"","active":true,"console":"false","complete":"headers","x":730,"y":180,"wires":[]}]
When I get home I can explain it better. Do not override anything otherwise it will get confused.
Use msg.url to pass the url and msg.method to pass whether it is get or post.
Provide headers in msg.payload in json format.
Hope it helps
Use msg.url to pass the url and msg.method to pass whether it is get or post.
Provide headers in msg.payload in json format.
msg.res is the response object provided by the HTTP In node - not the HTTP Request node.
Kay, the cookie provided by the first request will be under msg.headers - if you pass that to a debug node you'll see it has a property called 'cookies'. You should pass that property through to the next http request node... I think that would do it.
In the last release we made cookie handling easier with the HTTP In/Response node pair. We should look at doing the same with the Http request node.
Nick
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/968c154f-b4d5-4e8e-aadd-e9e9e51b0a0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.