# Node red is not giving http response

**URL:** <https://discourse.nodered.org/t/node-red-is-not-giving-http-response/17485>\
**Category:** General\
**Created:** [4 November 2019 13:22 UTC](https://discourse.nodered.org/t/node-red-is-not-giving-http-response/17485 "2019-11-04T13:22:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![akhtar321h](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@akhtar321h](https://discourse.nodered.org/u/akhtar321h)\
**Post date:** [4 November 2019 13:22 UTC](https://discourse.nodered.org/t/node-red-is-not-giving-http-response/17485/1 "2019-11-04T13:22:35Z")

</div>

Below is the flow that I am using, the rest api will internally call the lwm2m service and returns response. I wanted to give the lwm2m service reponse as http reponse.

`[{"id":"7ef85b8a.eecf74","type":"lwm2m client in","z":"d2ce8276.563c5","name":"","lwm2mClient":"9db4fd03.df67e","subscribeObjectEvents":false,"x":420,"y":260,"wires":[["7a71065c.0cac78","9c17b3fa.5004f"]]},{"id":"294af8c5.875f88","type":"inject","z":"d2ce8276.563c5","name":"","topic":"/420/0/0","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":200,"wires":[[]]},{"id":"7a71065c.0cac78","type":"debug","z":"d2ce8276.563c5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":710,"y":240,"wires":[]},{"id":"fac15cc4.bc82e","type":"inject","z":"d2ce8276.563c5","name":"","topic":"^/3/.*","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":260,"wires":[["7ef85b8a.eecf74"]]},{"id":"22ad3db2.d0e3a2","type":"http in","z":"d2ce8276.563c5","name":"","url":"/test","method":"post","upload":false,"swaggerDoc":"","x":120,"y":360,"wires":[["c801b62c.ae9f28","fb4b035a.2aa67"]]},{"id":"9c17b3fa.5004f","type":"function","z":"d2ce8276.563c5","name":"","func":"msg = {\"payload\": msg.payload , \"req\":flow.get(\"req\"),\"res\":flow.get(\"res\"),\"_msgid\":flow.get(\"_msgid\")};\n//msg._msgid =flow.get(\"_msgid\");\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":280,"wires":[["7a71065c.0cac78","75cc265b.0fa4d8"]]},{"id":"44a35eaa.feede","type":"lwm2m client out","z":"d2ce8276.563c5","name":"","lwm2mClient":"9db4fd03.df67e","x":540,"y":500,"wires":[]},{"id":"a7658a4a.cb0ac8","type":"udp in","z":"d2ce8276.563c5","name":"","iface":"","port":"1203","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":120,"y":500,"wires":[["c2bfae43.2f572"]]},{"id":"c2bfae43.2f572","type":"function","z":"d2ce8276.563c5","name":"","func":"\nvar result=parseInt(msg.payload);\nmsg1=\n{\n \"topic\":\"/420/0/0\",\n \"payload\":result,\n \n}\n\n\nreturn msg1;","outputs":1,"noerr":0,"x":310,"y":500,"wires":[["44a35eaa.feede"]]},{"id":"75cc265b.0fa4d8","type":"http response","z":"d2ce8276.563c5","name":"","statusCode":"","headers":{},"x":770,"y":280,"wires":[]},{"id":"c801b62c.ae9f28","type":"debug","z":"d2ce8276.563c5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":310,"y":400,"wires":[]},{"id":"fb4b035a.2aa67","type":"function","z":"d2ce8276.563c5","name":"","func":"flow.set(\"req\", msg.req);\nflow.set(\"res\", msg.res);\nmsg ={ _msgid: msg._msgid, topic: msg.payload.topic , payload: '' };\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":340,"wires":[["7ef85b8a.eecf74"]]},{"id":"9db4fd03.df67e","type":"lwm2m client","z":"","disabled":false,"clientName":"TMPL-FA-1663","enableDTLS":false,"clientPort":"5683","lifetimeSec":"300","reconnectSec":"30","requestBootstrap":false,"saveProvisionedConfig":false,"useIPv4":true,"serverHost":"leshan.iot-lab.info","serverPort":"5683","redirectLwm2mClientLog":false,"dumpLwm2mMessages":false,"hideSensitiveInfo":true,"propagateInternalEvents":false,"objects":"{\"420\":{\"0\":{\"0\":{\"type\":\"INTEGER\",\"acl\":\"RW\",\"value\":4},\"1\":{\"type\":\"FUNCTION\",\"acl\":\"E\",\"value\":\"\"},\"2\":true}}}"}]`

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [4 November 2019 16:41 UTC](https://discourse.nodered.org/t/node-red-is-not-giving-http-response/17485/2 "2019-11-04T16:41:45Z")

</div>

Please export your flow again, [read this post](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506) and edit your post.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [5 November 2019 07:30 UTC](https://discourse.nodered.org/t/node-red-is-not-giving-http-response/17485/5 "2019-11-05T07:30:14Z")

</div>

Please reread the post about how to post your flow

---

<div class="post-metadata">

**Author:** ![akhtar321h](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@akhtar321h](https://discourse.nodered.org/u/akhtar321h)\
**Post date:** [5 November 2019 07:54 UTC](https://discourse.nodered.org/t/node-red-is-not-giving-http-response/17485/6 "2019-11-05T07:54:05Z")

</div>

Below is the flow that I am using, the rest api will internally call the lwm2m service and returns response. I wanted to give the lwm2m service reponse as http reponse.

```auto
[{"id":"7ef85b8a.eecf74","type":"lwm2m client in","z":"d2ce8276.563c5","name":"","lwm2mClient":"9db4fd03.df67e","subscribeObjectEvents":false,"x":420,"y":260,"wires":[["7a71065c.0cac78","9c17b3fa.5004f"]]},{"id":"294af8c5.875f88","type":"inject","z":"d2ce8276.563c5","name":"","topic":"/420/0/0","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":200,"wires":[[]]},{"id":"7a71065c.0cac78","type":"debug","z":"d2ce8276.563c5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":710,"y":240,"wires":[]},{"id":"fac15cc4.bc82e","type":"inject","z":"d2ce8276.563c5","name":"","topic":"^/3/.*","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":260,"wires":[["7ef85b8a.eecf74"]]},{"id":"22ad3db2.d0e3a2","type":"http in","z":"d2ce8276.563c5","name":"","url":"/test","method":"post","upload":false,"swaggerDoc":"","x":120,"y":360,"wires":[["c801b62c.ae9f28","fb4b035a.2aa67"]]},{"id":"9c17b3fa.5004f","type":"function","z":"d2ce8276.563c5","name":"","func":"msg = {\"payload\": msg.payload , \"req\":flow.get(\"req\"),\"res\":flow.get(\"res\"),\"_msgid\":flow.get(\"_msgid\")};\n//msg._msgid =flow.get(\"_msgid\");\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":280,"wires":[["7a71065c.0cac78","75cc265b.0fa4d8"]]},{"id":"44a35eaa.feede","type":"lwm2m client out","z":"d2ce8276.563c5","name":"","lwm2mClient":"9db4fd03.df67e","x":540,"y":500,"wires":[]},{"id":"a7658a4a.cb0ac8","type":"udp in","z":"d2ce8276.563c5","name":"","iface":"","port":"1203","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":120,"y":500,"wires":[["c2bfae43.2f572"]]},{"id":"c2bfae43.2f572","type":"function","z":"d2ce8276.563c5","name":"","func":"\nvar result=parseInt(msg.payload);\nmsg1=\n{\n \"topic\":\"/420/0/0\",\n \"payload\":result,\n \n}\n\n\nreturn msg1;","outputs":1,"noerr":0,"x":310,"y":500,"wires":[["44a35eaa.feede"]]},{"id":"75cc265b.0fa4d8","type":"http response","z":"d2ce8276.563c5","name":"","statusCode":"","headers":{},"x":770,"y":280,"wires":[]},{"id":"c801b62c.ae9f28","type":"debug","z":"d2ce8276.563c5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":310,"y":400,"wires":[]},{"id":"fb4b035a.2aa67","type":"function","z":"d2ce8276.563c5","name":"","func":"flow.set(\"req\", msg.req);\nflow.set(\"res\", msg.res);\nmsg ={ _msgid: msg._msgid, topic: msg.payload.topic , payload: '' };\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":340,"wires":[["7ef85b8a.eecf74"]]},{"id":"9db4fd03.df67e","type":"lwm2m client","z":"","disabled":false,"clientName":"TMPL-FA-1663","enableDTLS":false,"clientPort":"5683","lifetimeSec":"300","reconnectSec":"30","requestBootstrap":false,"saveProvisionedConfig":false,"useIPv4":true,"serverHost":"leshan.iot-lab.info","serverPort":"5683","redirectLwm2mClientLog":false,"dumpLwm2mMessages":false,"hideSensitiveInfo":true,"propagateInternalEvents":false,"objects":"{\"420\":{\"0\":{\"0\":{\"type\":\"INTEGER\",\"acl\":\"RW\",\"value\":4},\"1\":{\"type\":\"FUNCTION\",\"acl\":\"E\",\"value\":\"\"},\"2\":true}}}"}]

```
