Depending on what I need from the endpoint I'm calling, I need to be able to send the payload as the request body using both GET & POST.
I'm creating a query to OpenSearch, sending the payload using a GET method, which uses OpenSearch's built-in cache, and sending the payload using the POST method; no caching is used on the OpenSearch side.
Sending the payload using the POST method works as expected; however, I have problems under GET.
If I set the method to GET in the editor, set the payload to;
Ignore
Append to query-string parameters.
Send as request body
I can set the payload option to Send as request body.
Choosing this option works as expected.
However;
I have created a subflow with the HTTP request method set to - set by msg.method
I don't have a payload option, and I understand why as the method is not know yet.
If I have the same JSON in the msg.payload, it is not sent to the endpoint; it is ignored by default.
The info for the HTTP request node states
payload
Sent as the body of the request.
How do I get the msg.payload to send as request body when method is being set by the msg.method?
I feel like I should be able to bend spoons by looking at them when I hear GET and Body in the same sentence.
But in actural fact, there is no rule to state a body should not be included in GET
RFC 7231
A payload within a GET request message has no defined semantics;
sending a payload body on a GET request might cause some existing
implementations to reject the request.
So whilst not normal, is not illegal
Doing a test - it would "seem" a body is not included in GET in the request node
As reported on forum and raised in #3957, the HTTP Request node could not set the payload handling for a get request.
The option set in the dropdown field before the method was changed to "use msg.method" and hidden would be used causing confusion to user.