Files
node/test/parallel/test-http-request-large-payload.js
Filip Skokan cb78f66ab3 test: avoid idle HTTP/HTTPS connections
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>
2026-09-13 14:01:14 +02:00

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();
});