Sjors Hijgenaar Sjors Hijgenaar - 2 years ago 183
HTTP Question

Posting binary buffer payload using Node-RED

I am trying to send a byte array through POST using Node-RED. I can successfully create the buffer using this module and storing it in

. However I can't figure out how to add it as a parameter in a http request node.

The receiving application requires enclosing quotes. So I use the payload in the following url:
, but it gives

"Error converting http params to args: invalid character '\' looking for beginning of value"

If using it in the request url without quotes:
nothing gets through (I can see on the other end).

I am using Protobuf due to the application on the other side, but I've also tried creating a buffer, as described here. However, nothing changes.

Answer Source

POSTs should not have arguments in the URL. The data should all be in the body.

Do you need to make the msg.payload an object with keys matching the arg names.

msg.payload = {
  var = [buffer]

You will probably have to play around with the content-type header as by default I believe Node-RED will send a JSON body and you probably want application/x-www-form-urlencoded

You can set the headers by adding a msg.headers object

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download