mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 06:08:50 +02:00
http: do not override user-provided options object
PR-URL: https://github.com/nodejs/node/pull/33633 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
7a216d5fd6
commit
c925039b35
3 changed files with 49 additions and 9 deletions
29
test/parallel/test-http-client-input-function.js
Normal file
29
test/parallel/test-http-client-input-function.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const http = require('http');
|
||||
const assert = require('assert');
|
||||
|
||||
{
|
||||
const server = http.createServer(common.mustCall((req, res) => {
|
||||
res.writeHead(200);
|
||||
res.end('hello world');
|
||||
})).listen(0, '127.0.0.1');
|
||||
|
||||
server.on('listening', common.mustCall(() => {
|
||||
const req = new http.ClientRequest(server.address(), common.mustCall((response) => {
|
||||
let body = '';
|
||||
response.setEncoding('utf8');
|
||||
response.on('data', (chunk) => {
|
||||
body += chunk;
|
||||
});
|
||||
|
||||
response.on('end', common.mustCall(() => {
|
||||
assert.strictEqual(body, 'hello world');
|
||||
server.close();
|
||||
}));
|
||||
}));
|
||||
|
||||
req.end();
|
||||
}));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue