dreamfactorysoftware / dreamfactory

DreamFactory API Management Platform
https://www.dreamfactory.com
Apache License 2.0
1.56k stars 314 forks source link

In post_process custom script the "event.response.content" is broken after updating from DF 2.0.4 -> DF 2.1.2 #32

Closed GabrielStetco closed 8 years ago

GabrielStetco commented 8 years ago

Hi,

In the version 2.1.2 in the post_process custom script the "event.response.content" is not reflecting the data pushed to it.

This is how the issue can be replicated:

event.response.status_code = 400;
event.response.content = {"test": "value"};

Push a record on the table. The expected result should be a 400 code response and {"test": "value"} as an output. Instead, the return code is modified correctly, but not the response.content, that will return always the original response.

Please advise. Best regards

Gabriel

juniorconte commented 8 years ago

This topic seems to be related to this problem:

http://community.dreamfactory.com/t/how-to-create-users-while-registering-with-different-roles-via-api/2190/4

leehicks commented 8 years ago

When changing the content of the response in an event script, you will need to set event.response.content_changed = true before it will get copied back to the main process stream. This was to prevent copying content unnecessarily when handling events.