forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
response.writableFinished is true if all data has been flushed to the underlying system. PR-URL: nodejs#28681 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Rich Trott <[email protected]>
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 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,32 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const http = require('http'); | ||
|
||
const server = http.createServer(common.mustCall(function(req, res) { | ||
assert.strictEqual(res.writableFinished, false); | ||
res | ||
.on('finish', common.mustCall(() => { | ||
assert.strictEqual(res.writableFinished, true); | ||
server.close(); | ||
})) | ||
.end(); | ||
})); | ||
|
||
server.listen(0); | ||
|
||
server.on('listening', common.mustCall(function() { | ||
const clientRequest = http.request({ | ||
port: server.address().port, | ||
method: 'GET', | ||
path: '/' | ||
}); | ||
|
||
assert.strictEqual(clientRequest.writableFinished, false); | ||
clientRequest | ||
.on('finish', common.mustCall(() => { | ||
assert.strictEqual(clientRequest.writableFinished, true); | ||
})) | ||
.end(); | ||
assert.strictEqual(clientRequest.writableFinished, false); | ||
})); |