Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-http-response-readable.js « parallel « test - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a4906643d3d35b2eb4863c359adcfca9e4f5676a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict';
require('../common');
const assert = require('assert');
const http = require('http');

const testServer = new http.Server(function(req, res) {
  res.writeHead(200);
  res.end('Hello world');
});

testServer.listen(0, function() {
  http.get({ port: this.address().port }, function(res) {
    assert.strictEqual(res.readable, true, 'res.readable initially true');
    res.on('end', function() {
      assert.strictEqual(res.readable, false,
                         'res.readable set to false after end');
      testServer.close();
    });
    res.resume();
  });
});