From ac6dad9fb5071bddd7a95c32cc38e9cc15c57228 Mon Sep 17 00:00:00 2001 From: osher Date: Wed, 9 Nov 2016 19:37:40 +0200 Subject: [PATCH] middleware chain is broken when found ctx.output I'm not sure about this - I need your eyes here. If I'm on target - I'll add tests so you can merge. I'm using restify, and I have other mw on the chain after the swagger_router. (e.g `server.on('after', restify.auditLogger(options.auditLogCfg));` ) I first noted that when I dont use json_error_handler - I get the audit entry on requests that error, and when I do - I dont. (e.g. - the 'after' event is not emitted) The research led me to the corrected lines. --- lib/connect_middleware.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/connect_middleware.js b/lib/connect_middleware.js index f7922a6..aa7439f 100644 --- a/lib/connect_middleware.js +++ b/lib/connect_middleware.js @@ -89,9 +89,9 @@ function Middleware(runner) { debugContent('sending response body: %s', body); response.end(body); - } else { - next(); - } + } + + next(); } catch (err) { /* istanbul ignore next */