mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
599 B
22 lines
599 B
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const server = http.Server(common.mustCall(function(req, res) {
|
|
res.on('error', common.mustCall(function onResError(err) {
|
|
assert.strictEqual(err.message, 'write after end');
|
|
}));
|
|
|
|
res.write('This should write.');
|
|
res.end();
|
|
|
|
const r = res.write('This should raise an error.');
|
|
assert.strictEqual(r, true, 'write after end should return true');
|
|
}));
|
|
|
|
server.listen(0, function() {
|
|
http.get({port: this.address().port}, function(res) {
|
|
server.close();
|
|
});
|
|
});
|
|
|