mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
Single-use requests otherwise wait for the keep-alive timeout. Use nonpersistent agents where agent selection is unrelated to coverage. For default-agent tests, close the server after consuming the response. Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex PR-URL: https://github.com/nodejs/node/pull/65980 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
28 lines
561 B
JavaScript
28 lines
561 B
JavaScript
'use strict';
|
|
require('../common');
|
|
|
|
// This test ensures Node.js doesn't throw an error when making requests with
|
|
// the payload 16kb or more in size.
|
|
// https://github.com/nodejs/node/issues/2821
|
|
|
|
const http = require('http');
|
|
|
|
const server = http.createServer(function(req, res) {
|
|
res.writeHead(200);
|
|
res.end();
|
|
|
|
server.close();
|
|
});
|
|
|
|
server.listen(0, function() {
|
|
const req = http.request({
|
|
agent: false,
|
|
method: 'POST',
|
|
port: this.address().port
|
|
});
|
|
|
|
const payload = Buffer.alloc(16390, 'Й');
|
|
req.write(payload);
|
|
req.end();
|
|
});
|