Files
node/test/parallel/test-http-request-arguments.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

29 lines
696 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const http = require('http');
// Test providing both a url and options, with the options partially
// replacing address and port portions of the URL provided.
{
const server = http.createServer(
common.mustCall((req, res) => {
assert.strictEqual(req.url, '/testpath');
res.end();
server.close();
})
);
server.listen(
0,
common.mustCall(() => {
http.get(
'http://example.com/testpath',
{ hostname: 'localhost', port: server.address().port, agent: false },
common.mustCall((res) => {
res.resume();
})
);
})
);
}