Files
node/test/parallel/test-http-server-delete-parser.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

26 lines
522 B
JavaScript

'use strict';
const common = require('../common');
const http = require('http');
const server = http.createServer(common.mustCall((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write('okay', common.mustCall(() => {
delete res.socket.parser;
}));
res.end();
}));
server.listen(0, '127.0.0.1', common.mustCall(() => {
const req = http.request({
agent: false,
port: server.address().port,
host: '127.0.0.1',
method: 'GET',
});
req.end();
}));
server.unref();