Fix expected webhook external response format (#1934)
This commit is contained in:
@@ -381,7 +381,7 @@ describe('Hooks', () => {
|
|||||||
object.hello = "world";
|
object.hello = "world";
|
||||||
// Would need parse cloud express to set much more
|
// Would need parse cloud express to set much more
|
||||||
// But this should override the key upon return
|
// 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
|
// The function is delete as the DB is dropped between calls
|
||||||
Parse.Hooks.createTrigger("SomeRandomObject", "beforeSave" ,hookServerURL+"/BeforeSaveSome").then(function(){
|
Parse.Hooks.createTrigger("SomeRandomObject", "beforeSave" ,hookServerURL+"/BeforeSaveSome").then(function(){
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ function wrapToHTTPRequest(hook, key) {
|
|||||||
request.post(hook.url, jsonRequest, function (err, httpResponse, body) {
|
request.post(hook.url, jsonRequest, function (err, httpResponse, body) {
|
||||||
var result;
|
var result;
|
||||||
if (body) {
|
if (body) {
|
||||||
if (typeof body == "string") {
|
if (typeof body === "string") {
|
||||||
try {
|
try {
|
||||||
body = JSON.parse(body);
|
body = JSON.parse(body);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -204,6 +204,8 @@ function wrapToHTTPRequest(hook, key) {
|
|||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
return res.error(err);
|
return res.error(err);
|
||||||
|
} else if (hook.triggerName === 'beforeSave') {
|
||||||
|
return res.success({object: result});
|
||||||
} else {
|
} else {
|
||||||
return res.success(result);
|
return res.success(result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user