summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-incoming-message-options.js
blob: 61e178eb47aedac61250b586a90aabc64f35e338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'use strict';
const common = require('../common');
const assert = require('assert');
const http = require('http');
const net = require('net');
const readableHighWaterMark = 1024;
const server = http.createServer((req, res) => { res.end(); });

server.listen(0, common.mustCall(() => {
  const req = http.request({
    port: server.address().port,
    createConnection(options) {
      options.readableHighWaterMark = readableHighWaterMark;
      return net.createConnection(options);
    }
  }, common.mustCall((res) => {
    assert.strictEqual(res.socket, req.socket);
    assert.strictEqual(res.socket.readableHighWaterMark, readableHighWaterMark);
    assert.strictEqual(res.readableHighWaterMark, readableHighWaterMark);
    server.close();
  }));

  req.end();
}));