From 2600a20eca77349f4fbd21126cb67d857f540cda Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Wed, 31 Aug 2016 10:24:28 +0800 Subject: [PATCH] fix: add named function for request and response handlers (#804) --- lib/application.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/application.js b/lib/application.js index 5750d96..8b6a78b 100644 --- a/lib/application.js +++ b/lib/application.js @@ -129,11 +129,11 @@ app.callback = function(){ if (!this.listeners('error').length) this.on('error', this.onerror); - return function(req, res){ + return function handleRequest(req, res){ res.statusCode = 404; var ctx = self.createContext(req, res); onFinished(res, ctx.onerror); - fn.call(ctx).then(function () { + fn.call(ctx).then(function handleResponse() { respond.call(ctx); }).catch(ctx.onerror); }