Add msg property payloadHandling
for setting how a GET request handles payload
#3961
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Types of changes
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.Proposed changes
As described in the issue, this PR adds a
msg
property to permit the user to specify the payload handling via msg.payloadHandling`Other changes include...
msg.payloadHandling
propertyConsiderations & points of discussion before merging...
Although setting body in a GET request is VERY uncommon (many web servers even prohibit this) there may be some flows in the wild that work "by accident" (having set the payload handling dropdown to "add payload to body" or "add payload to querystring") BEFORE setting the method dropdown to "Use msg.method". We may want to use the nodes value OR consider showing the payload handling dropdown & adding a "use msg.payloadHandling" entry?options.json
instead ofoptions.body
when making the request, then the body is delivered! I was curious if this ever worked and fired up Node-RED v1.3.7 (using REQUEST instead of GOT) & it seems it may be express discarding thebody
. I have no way to prove this works other than to say, if theallowGetBody
option is NOT set and we include abody
, we get the errorThe 'GET' method cannot be used with a body
! So we can only assume it works.Checklist
grunt
to verify the unit tests pass