-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: fix test where aborted should not be emitted
PR-URL: #20077 Fixes: #20107 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
- Loading branch information
Showing
6 changed files
with
60 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const http = require('http'); | ||
const assert = require('assert'); | ||
|
||
const server = http.createServer(common.mustCall(function(req, res) { | ||
req.on('aborted', common.mustCall(function() { | ||
assert.strictEqual(this.aborted, true); | ||
server.close(); | ||
})); | ||
assert.strictEqual(req.aborted, false); | ||
res.write('hello'); | ||
})); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
const req = http.get({ | ||
port: server.address().port, | ||
headers: { connection: 'keep-alive' } | ||
}, common.mustCall((res) => { | ||
req.abort(); | ||
})); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const http = require('http'); | ||
|
||
const server = http.createServer(common.mustCall((req, res) => { | ||
res.write('hello'); | ||
})); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
const req = http.get({ | ||
port: server.address().port | ||
}, common.mustCall((res) => { | ||
req.on('error', common.mustNotCall()); | ||
req.abort(); | ||
req.socket.destroy(new Error()); | ||
req.on('close', common.mustCall(() => { | ||
server.close(); | ||
})); | ||
})); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters