Comparing version 3.0.0 to 3.1.0
@@ -70,2 +70,11 @@ 'use strict' | ||
if (res.finished === true) { | ||
that.req = null | ||
that.res = null | ||
that.context = null | ||
that.i = 0 | ||
pool.release(that) | ||
return | ||
} | ||
if (err || middlewares.length === i) { | ||
@@ -72,0 +81,0 @@ complete(err, req, res, context) |
{ | ||
"name": "middie", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Middleware engine for Fastify", | ||
@@ -5,0 +5,0 @@ "main": "middie.js", |
29
test.js
@@ -333,1 +333,30 @@ 'use strict' | ||
}) | ||
test('if the function calls res.end the iterator should stop', t => { | ||
t.plan(1) | ||
const instance = middie(function () { | ||
t.fail('we should not be here') | ||
}) | ||
const req = { | ||
url: '/test' | ||
} | ||
const res = { | ||
finished: false, | ||
end: function () { | ||
t.pass('res.end') | ||
this.finished = true | ||
} | ||
} | ||
instance | ||
.use(function (req, res, next) { | ||
res.end('hello') | ||
next() | ||
}) | ||
.use(function (req, res, next) { | ||
t.fail('we should not be here') | ||
}) | ||
instance.run(req, res) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14848
411