Skip to content

Commit e3abdb8

Browse files
blachaRafael Santos
authored and
Rafael Santos
committed
Run next() after successfully sending data to the client (parse-community#2338)
This allows developers to add express handlers for successful completion of parse-server requests. ie Analytics or Logging.
1 parent 40eb70e commit e3abdb8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/PromiseRouter.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,17 @@ function makeExpressHandler(appId, promiseHandler) {
184184
res.status(status);
185185

186186
if (result.text) {
187-
return res.send(result.text);
187+
res.send(result.text);
188+
return next();
188189
}
189190

190191
if (result.location) {
191192
res.set('Location', result.location);
192193
// Override the default expressjs response
193194
// as it double encodes %encoded chars in URL
194195
if (!result.response) {
195-
return res.send('Found. Redirecting to '+result.location);
196+
res.send('Found. Redirecting to '+result.location);
197+
return next();
196198
}
197199
}
198200
if (result.headers) {
@@ -201,6 +203,7 @@ function makeExpressHandler(appId, promiseHandler) {
201203
})
202204
}
203205
res.json(result.response);
206+
next();
204207
}, (e) => {
205208
log.error(`Error generating response. ${inspect(e)}`, {error: e});
206209
next(e);

0 commit comments

Comments
 (0)