Response header 'success'

I have that situation obraz
Node-red is a Server, and I have to create response with header
obraz
I created [{"id":"d44b102d.310108","type":"http in","z":"15ff44a1.77852b","name":"","url":"/czujnik","method":"post","upload":false,"swaggerDoc":"","x":70,"y":700,"wires":[["800c842a.ebeb98","f1699fcf.c4d48"]]},{"id":"800c842a.ebeb98","type":"debug","z":"15ff44a1.77852b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":330,"y":640,"wires":[]},{"id":"f1699fcf.c4d48","type":"function","z":"15ff44a1.77852b","name":"postRecordedData","func":"msg.payload = \"postRecordedData\";\nmsg.headers = {};\n//msg.headers= ['HTTP/1.1 200 Success'];\nmsg.headers['statusCode']='200';\nmsg.headers['Server']='100.0.0.75';\nmsg.headers['Content-Type']='application/octet-stream';\nmsg.headers['Content-Length']='0';\nmsg.headers['Connection']='keep-alive';\nmsg.headers['X-Content-Type-Options']='nosniff';\nmsg.headers['X-Tandd-Next-Command']='none';\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":290,"y":700,"wires":[["8e6f0a5e.09d12"]]},{"id":"8e6f0a5e.09d12","type":"http request","z":"15ff44a1.77852b","name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"10.0.0.100","tls":"","persist":false,"proxy":"","authType":"","x":510,"y":700,"wires":[["215069b1.e963f6"]]},{"id":"215069b1.e963f6","type":"debug","z":"15ff44a1.77852b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":690,"y":700,"wires":[]}]


PostRecordedData is:

msg.payload = "postRecordedData";
msg.headers = {};
msg.headers['statusCode']='200';
msg.headers['Server']='100.0.0.75';
msg.headers['Content-Type']='application/octet-stream';
msg.headers['Content-Length']='0';
msg.headers['Connection']='keep-alive';
msg.headers['X-Content-Type-Options']='nosniff';
msg.headers['X-Tandd-Next-Command']='none';

return msg;

What's wrong, because I have message from Base Unit that not success

You currently have an HTTP Request node in your flow. That is used to send http requests to a server.

In this case, you are trying to respond to an HTTP Request that has been received by the HTTP In node. You should use the HTTP Response node to do that.

like that?
obraz
obraz

but the same information about not succes in Base Unit

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.