mirror of
https://github.com/nodejs/node.git
synced 2024-11-28 22:46:31 +01:00
3e1b1dd4a9
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
29 lines
712 B
JavaScript
29 lines
712 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
var http = require('http');
|
|
|
|
var responseError;
|
|
|
|
var server = http.Server(function(req, res) {
|
|
res.on('error', function onResError(err) {
|
|
responseError = err;
|
|
});
|
|
|
|
res.write('This should write.');
|
|
res.end();
|
|
|
|
var r = res.write('This should raise an error.');
|
|
assert.equal(r, true, 'write after end should return true');
|
|
});
|
|
|
|
server.listen(common.PORT, function() {
|
|
var req = http.get({port: common.PORT}, function(res) {
|
|
server.close();
|
|
});
|
|
});
|
|
|
|
process.on('exit', function onProcessExit(code) {
|
|
assert(responseError, 'response should have emitted error');
|
|
assert.equal(responseError.message, 'write after end');
|
|
});
|