summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-request-end-twice.js
blob: 871880e51463d8f35b1df1dd549648098b0e6bd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
var common = require('../common');
var assert = require('assert');
var http = require('http');

var server = http.Server(function(req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('hello world\n');
});
server.listen(common.PORT, function() {
  var req = http.get({port: common.PORT}, function(res) {
    res.on('end', function() {
      assert.ok(!req.end());
      server.close();
    });
    res.resume();
  });
});