Open mjclemente opened 3 years ago
Add a new configuration boolean variable variables.framework.decodeRerquestBodyMergeRC (defaulted to true to preserve existing behavior)
Update var bodyStruct = read_json( body ); if ( isStruct( bodyStruct ) ) { structAppend( request.context, bodyStruct ); } else { request.context[ 'body' ] = bodyStruct; }
to
var bodyStruct = read_json( body ); if ( isStruct( bodyStruct ) && decodeRerquestBodyMergeRC ) { structAppend( request.context, bodyStruct ); } else { request.context[ 'body' ] = bodyStruct; }
Alternatively suggested "o piggy back on what sneiland said, perhaps a framework var along the lines of decodeRequestBodyTo with a default of "rc" which means key/value, or anything other than rc specifies the variable to write it into in rc. decodeRequestBodyTo = "requestbody" would yield rc.requestbody with the contents"
This is an enhancement request. Happy to help with a PR if it's deemed worthwhile.
I posted this on the Slack channel:
Did a little digging, and it looks like FW/1 doesn't have a built-in method or variable for accessing the request body (
getHttpRequestData().content
). Our app is receiving webhooks, and we want to access/store the entire payload. Since the framework is already parsing the body, maybe it makes sense to make this easily available to the app.