Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Full Request Body available #537

Open
mjclemente opened this issue Sep 24, 2021 · 2 comments
Open

Make Full Request Body available #537

mjclemente opened this issue Sep 24, 2021 · 2 comments

Comments

@mjclemente
Copy link
Contributor

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.

@sneiland
Copy link
Contributor

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;
}

@sneiland
Copy link
Contributor

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants