Send and receive Raw HTTP requests

Hi,

I need to send a raw HTTP request with n8n. Is this possible? So something like below.
Would also need the raw response from this request.

GET /search?q=test HTTP/2
Host: [www.bing.com](http://www.bing.com/)
User-Agent: curl/7.54.0
Accept: */*

{ “q”: “test” }

Hope someone knows how to do this. :slight_smile:

Hi @BramKn ,

Here is how you would do that in n8n, just paste this code directly into the n8n canvas interface:

1 Like

Hi @djangelic

Sorry, my question wasn’t clear apparently.
I know how to make a normal HTTP request :slight_smile:

I need to be able to put in a raw request and send it. As I am going to have thousands of them, all different and not all valid.
The request I receive is the RAW request like I Showed.
With that request send, I am expecting a RAW response. So I need to send and receive the raw data.

Hope my question is clear now.

Hey @BramKn,

Is it always that format that you get your request in and how are they being sent to n8n?

The approach that @djangelic has taken should do the job if you have a standard input format as you can use variables to set the data in the node. You can then set the node to return the full response which will give you everything to then process later.

If you can provide a bit more info we might be able to work something out.

1 Like

Hi @Jon

I will be getting all kinds of RAW requests. I want to send them without processing. They need to be tested as is. If I process them to fit the standard HTTP request node, there is bound to be differences with the actual RAW request.
The request I am getting can make no sense at all. If I am processing that, it will probably result in an error and not be sent.
I am guessing I will need to use the function node, but haven’t been able to find a way to send a raw request.

I have no actual examples, unfortunately.

Hey @BramKn,

That is where it gets tricky, So to process a raw request you would need to use something like nc or the openssl command line tool so you would take your input then use an execute command node and pass it to whatever command you go for.

The other more complex answer would be to use something like the NodeJS net package in a function node to handle it which I don’t have any examples for so it will involve a good chunk of learning / searching.

1 Like

Thanks @Jon
I will go on a search then. :slight_smile:

1 Like