|
[{"id":"3a7824226fcfa66d","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"833db30a8cb93f9c","type":"http in","z":"3a7824226fcfa66d","name":"","url":"/foo","method":"post","upload":false,"swaggerDoc":"","x":180,"y":180,"wires":[["cb9236ba739c664e"]]},{"id":"f0a3fead9252c48a","type":"http response","z":"3a7824226fcfa66d","name":"","statusCode":"","headers":{},"x":670,"y":180,"wires":[]},{"id":"798019ce7bc287c6","type":"tcp in","z":"3a7824226fcfa66d","name":"","server":"server","host":"","port":"1882","datamode":"stream","datatype":"utf8","newline":"","topic":"","trim":false,"base64":false,"tls":"","x":200,"y":320,"wires":[["c2ab47e157cea238","93d1a184c7381891"]]},{"id":"eeacbf575d4041f8","type":"debug","z":"3a7824226fcfa66d","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":320,"wires":[]},{"id":"e8d7a1526a7361cf","type":"tcp out","z":"3a7824226fcfa66d","name":"","host":"","port":"","beserver":"reply","base64":false,"end":false,"tls":"","x":230,"y":460,"wires":[]},{"id":"c2ab47e157cea238","type":"template","z":"3a7824226fcfa66d","name":"Send 200 OK","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"HTTP/1.1 200 \nConnection: Close\nContent-Length: 2\n\nOK","output":"str","x":220,"y":400,"wires":[["e8d7a1526a7361cf"]]},{"id":"93d1a184c7381891","type":"function","z":"3a7824226fcfa66d","name":"Parse Request","func":"let rawBody = msg.payload.split('\\r\\n\\r\\n')[1]\nnode.warn(msg.payload)\nlet r = httpZ.parse(msg.payload);\n\nlet h = {}\nfor (let i = 0; i < r.headers.length; i++) {\n let n = {}\n n[r.headers[i]['name']] = r.headers[i]['value']\n Object.assign(h, n);\n}\nr.headers = h\nr.rawBody = rawBody\nmsg.payload = r\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"httpZ","module":"http-z"}],"x":420,"y":320,"wires":[["eeacbf575d4041f8"]]},{"id":"cb9236ba739c664e","type":"function","z":"3a7824226fcfa66d","name":"Redirect to Port 1882","func":"let hostname = msg.req.headers.host.split(\":\")[0]\nmsg.headers ={}\nmsg.headers.location = `http://${hostname}:1882${msg.req.url}`\nmsg.statusCode = 307\nmsg.payload = ''\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":180,"wires":[["f0a3fead9252c48a"]]}] |