HTTP post sending body as Base64Encoded

When using the HTTP node to try and send a POST request, I’ve noticed it sends the body in Base64Encoded. Is there a way to stop and sending it in its raw form?

Hi @Justin_Gilbert_OD,
and welcome at n8n :wave:

I just set up a node-express server and could not find that the body content was converted to base64 ([email protected]). However, I’m not very familiar with HTTP, so I can’t say for sure that the raw data is always Base64 and must be parsed.

From my point of view n8n behaves completely normal, all servers (node-express, microsoft api, aso.) can handle the sent data. Therefore some details would be necessary for me to possibly help.

It would be good to know:

  • what is in the HTTP request node (copy and paste code).
  • what kind of server the data is sent to (self-hosted or a service)
  • maybe the hole workflow (if no sensitive data is involved)

The issue could possibly be that I am trying to send XML and I am not sure if the HTTP node allows that?

This is what I am getting on the receiving end:

@Justin_Gilbert_OD thank you for posting your node. I have rebuild it at n8n v0.191.1 and … @jan there is a bug (?) with “Body Content Type: RAW/Custom”. The body and query is ignored. Or my node express server is broken :man_shrugging:

I send the data at node express. Body and Query are empty.

If I send the same config with “Body Content Type: JSON” both works fine.

So, I think @Justin_Gilbert_OD use an other version of n8n so the body “works”. Can you tell us which n8n version you use? And you could test set in Options “MIME Type” to “text/xml”, maybe it works.

I got it to work by setting, the issue seems to be that there is no application/html option in the Content Type field:

1 Like

@jan I have customized my node express server a little bit. Body is now recognized. But “Query Parameters” are still not sent under Custom/RAW. At least nothing arrives at my node express server. Do I have to adjust this somewhere?

@Justin_Gilbert_OD and for documentation. After a little searching I found out that servers accept “raw” data (no associated MIME type) as buffer. Apparently your server automatically converts buffers to Base64. Would be very likely at least.

Well configured servers convert the data according to the MIME type.

Hi @Justin_Gilbert_OD, glad to hear it’s working for you with the additional MIME Type.

@BillAlex I think you’re quite right. This seems to be behaviour specific to the server used here. Running the below workflow based on the screenshot provided by @Justin_Gilbert_OD still sends non-encoded data which can be viewed on for example:

Query strings shouldn’t be part of the body though @BillAlex, they’ll arrive as part of the URL path like so:

Express provides some convenience features to parse them, check this article for example.

1 Like