hopefully last fix for request ended logic
This commit is contained in:
parent
3b7af0f290
commit
76b3852aeb
2 changed files with 4 additions and 11 deletions
|
@ -393,17 +393,17 @@ export class Flaska {
|
|||
|
||||
req.on('error', (err) => {
|
||||
this._onreqerror(err, ctx)
|
||||
this.requestEnded(ctx)
|
||||
})
|
||||
res.on('error', (err) => {
|
||||
this._onreserror(err, ctx)
|
||||
})
|
||||
|
||||
req.on('aborted', function() {
|
||||
req.on('aborted', () => {
|
||||
ctx.aborted = true
|
||||
})
|
||||
req.on('close', () => {
|
||||
this.requestEnded(ctx)
|
||||
})
|
||||
|
||||
res.on('finish', () => {
|
||||
this.requestEnded(ctx)
|
||||
})
|
||||
|
|
|
@ -22,7 +22,7 @@ t.describe('#requestStart()', function() {
|
|||
flaska.requestEnd = function(err, ctx) {
|
||||
try {
|
||||
assert.ok(err)
|
||||
assert.strictEqual(assertReq.on.callCount, 3)
|
||||
assert.strictEqual(assertReq.on.callCount, 2)
|
||||
assert.strictEqual(assertRes.on.callCount, 2)
|
||||
|
||||
|
||||
|
@ -53,13 +53,6 @@ t.describe('#requestStart()', function() {
|
|||
assertReq.on.secondCall[1]()
|
||||
assert.strictEqual(ctx.aborted, true)
|
||||
|
||||
assert.strictEqual(assertReq.on.thirdCall[0], 'close')
|
||||
assert.strictEqual(typeof(assertReq.on.thirdCall[1]), 'function')
|
||||
assert.strictEqual(onEnded.callCount, 1)
|
||||
assertReq.on.thirdCall[1]()
|
||||
assert.strictEqual(onEnded.callCount, 2)
|
||||
assert.strictEqual(onEnded.secondCall[0], ctx)
|
||||
|
||||
// Test abort and close
|
||||
|
||||
cb()
|
||||
|
|
Loading…
Reference in a new issue