Hi colleagues,
I'm currently learning web development based on HTTP/JS.
Node-RED: 1.2.9
My current problem/challenge is the following:
I want to transfer a simple JSON object from HTTP/JS code in my browser via the http-in node into a node-red function node for further processing:
JS snippet executed in Browser
const myInit = {
method: 'POST',
headers: {"Header":"MyHeader"},
mode: 'no-cors',
cache: 'default',
body: {"Body":"MyBody"}
};
data=fetch('https://nodered/ButtonReceiver?Name=123456',myInit)
On the Node-Red Server side I've set the following
http-in node is configured as "POST" and the URL above.
Executing the js script provides no errors, ( HTTP:200)
but:
the payload coming from the node's output is always "[object ] [object]", and I can't resolve these objects.
The parameters after the "?" are transferred instead correctly
I'd appreciate to get some hints or an example, what's wrong with my approach.
And: how would I get data back into my JS from an http send node ?
Thanks in advance,
Regards Thomas