From 91ecce1d763f4be326cf7d157621a995eb7214c2 Mon Sep 17 00:00:00 2001 From: Tejas Manohar Date: Thu, 8 Oct 2015 23:49:17 -0500 Subject: [PATCH] use arrow fn to avoid var self = this --- lib/application.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/application.js b/lib/application.js index 6ef0600..3134936 100644 --- a/lib/application.js +++ b/lib/application.js @@ -119,13 +119,12 @@ app.callback = function(){ const fn = this.experimental ? compose_es7(this.middleware) : co.wrap(compose(this.middleware)); - const self = this; if (!this.listeners('error').length) this.on('error', this.onerror); - return function(req, res){ + return (req, res) => { res.statusCode = 404; - const ctx = self.createContext(req, res); + const ctx = this.createContext(req, res); onFinished(res, ctx.onerror); fn.call(ctx).then(function () { respond.call(ctx);