0
votes

I'm trying to create a http get node that takes form data and then creates an http post to another web site using a rest API. I'm able to get the http call to return the correct payload however the http response node is giving a "no response object" error in the debug tab and the client never returns. Do I specifically need to do something to pass the response object so the call sends the correct response object to the http response node?

Here is the flow: [{"id":"7011e7a9.8fee18","type":"http request","name":"","method":"use","ret":"obj","url":"","x":499,"y":84,"z":"51693a88.ae96c4","wires":[["efea497c.1015b8"]]},{"id":"589f2a18.a760d4","type":"function","name":"","func":"var myprocess = context.global.process;\nmyprocess.env.NODE_TLS_REJECT_UNAUTHORIZED = \"0\";\nvar dev_url = \"https://website.com:22411/central/api/qracore/browses?browseId=mfg:gp239\";\n \nvar msg = {\n \"method\" : \"GET\",\n \"url\" : dev_url,\n \"headers\" : {\n \"Authorization\": \"Basic abWZnQHFhZC5jb206=\",\n \"Origin\" : \"mybox.com\"\n }\n};\n \nreturn msg;","outputs":1,"noerr":0,"x":323,"y":154,"z":"51693a88.ae96c4","wires":[["7011e7a9.8fee18"]]},{"id":"9f65b624.609a48","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":810,"y":211,"z":"51693a88.ae96c4","wires":[]},{"id":"38e4c04d.c71b4","type":"http in","name":"","url":"/workOrders","method":"get","swaggerDoc":"","x":152,"y":190,"z":"51693a88.ae96c4","wires":[["589f2a18.a760d4"]]},{"id":"e5ee54b2.1a11a8","type":"http response","name":"","x":770,"y":96,"z":"51693a88.ae96c4","wires":[]},{"id":"efea497c.1015b8","type":"function","name":"","func":"var newMsg = { payload: msg.payload };\nreturn newMsg;","outputs":1,"noerr":0,"x":582,"y":214,"z":"51693a88.ae96c4","wires":[["e5ee54b2.1a11a8","9f65b624.609a48"]]}]

1
Please post your code. - Jugal Shah
Please format your code properly. It is unreadable. - Francesco Boi

1 Answers

7
votes

The key is to pass it from node to the other. You do that by using the req and the res from the msg to pass to the output.

var newMsg = { payload: msg.payload };
//return [msg, newMsg];

newMsg.user = msg.req.body["user"];
newMsg.req  = msg.req;
newMsg.res = msg.res;

return newMsg;