1// Flags: --expose-internals 2'use strict'; 3const common = require('../common'); 4const assert = require('assert'); 5const http = require('http'); 6const { kHighWaterMark } = require('_http_outgoing'); 7 8const { getDefaultHighWaterMark } = require('internal/streams/state'); 9 10function listen(server) { 11 server.listen(0, common.mustCall(() => { 12 http.get({ 13 port: server.address().port, 14 }, (res) => { 15 assert.strictEqual(res.statusCode, 200); 16 res.resume().on('end', common.mustCall(() => { 17 server.close(); 18 })); 19 }); 20 })); 21} 22 23{ 24 const server = http.createServer({ 25 highWaterMark: getDefaultHighWaterMark() * 2, 26 }, common.mustCall((req, res) => { 27 assert.strictEqual(req._readableState.highWaterMark, getDefaultHighWaterMark() * 2); 28 assert.strictEqual(res[kHighWaterMark], getDefaultHighWaterMark() * 2); 29 res.statusCode = 200; 30 res.end(); 31 })); 32 33 listen(server); 34} 35 36{ 37 const server = http.createServer( 38 common.mustCall((req, res) => { 39 assert.strictEqual(req._readableState.highWaterMark, getDefaultHighWaterMark()); 40 assert.strictEqual(res[kHighWaterMark], getDefaultHighWaterMark()); 41 res.statusCode = 200; 42 res.end(); 43 }) 44 ); 45 46 listen(server); 47} 48