Skip to content

Fix expected webhook external response format #1934

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

Merged
merged 1 commit into from
May 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/ParseHooks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ describe('Hooks', () => {
object.hello = "world";
// Would need parse cloud express to set much more
// But this should override the key upon return
res.json({success: {object: object}});
res.json({success: object});
});
// The function is delete as the DB is dropped between calls
Parse.Hooks.createTrigger("SomeRandomObject", "beforeSave" ,hookServerURL+"/BeforeSaveSome").then(function(){
Expand Down
4 changes: 3 additions & 1 deletion src/Controllers/HooksController.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function wrapToHTTPRequest(hook, key) {
request.post(hook.url, jsonRequest, function (err, httpResponse, body) {
var result;
if (body) {
if (typeof body == "string") {
if (typeof body === "string") {
try {
body = JSON.parse(body);
} catch (e) {
Expand All @@ -204,6 +204,8 @@ function wrapToHTTPRequest(hook, key) {
}
if (err) {
return res.error(err);
} else if (hook.triggerName === 'beforeSave') {
return res.success({object: result});
} else {
return res.success(result);
}
Expand Down