Return middleware chain promise from callback() (#848)

The v2.x version of 8836cd3 on master.
This commit is contained in:
Lee Bousfield 2017-03-08 00:05:28 -07:00 committed by jongleberry
parent 65c130db5b
commit e6539e1cf2

View file

@ -134,7 +134,7 @@ module.exports = class Application extends Emitter {
const onerror = err => ctx.onerror(err); const onerror = err => ctx.onerror(err);
const handleResponse = () => respond(ctx); const handleResponse = () => respond(ctx);
onFinished(res, onerror); onFinished(res, onerror);
fn(ctx).then(handleResponse).catch(onerror); return fn(ctx).then(handleResponse).catch(onerror);
}; };
return handleRequest; return handleRequest;