0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 23:43:09 +01:00
nodejs/test/simple/test-http-write-empty-string.js
Oleg Efimov 093dfaf801 GJSLint all tests, only 3 long lines left in test-url.js
test/simple/test-url.js:31:(0110) Line too long (82 characters).
test/simple/test-url.js:39:(0110) Line too long (85 characters).
test/simple/test-url.js:40:(0110) Line too long (92 characters).
2010-12-05 15:42:41 -08:00

40 lines
889 B
JavaScript

var common = require('../common');
var assert = require('assert');
var http = require('http');
var server = http.createServer(function(request, response) {
console.log('responding to ' + request.url);
response.writeHead(200, {'Content-Type': 'text/plain'});
response.write('1\n');
response.write('');
response.write('2\n');
response.write('');
response.end('3\n');
this.close();
});
var response = '';
process.addListener('exit', function() {
assert.equal('1\n2\n3\n', response);
});
server.listen(common.PORT, function() {
var client = http.createClient(common.PORT);
var req = client.request('/');
req.end();
req.addListener('response', function(res) {
assert.equal(200, res.statusCode);
res.setEncoding('ascii');
res.addListener('data', function(chunk) {
response += chunk;
});
common.error('Got /hello response');
});
});