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.
29 lines
716 B
29 lines
716 B
'use strict';
|
|
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() {
|
|
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');
|
|
});
|
|
|