mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 09:52:21 +00:00

Removes the following files: - test/fixtures/url-tests.js - test/fixtures/url-setter-tests.js - test/fixtures/url-toascii.js in favor of: - test/fixtures/wpt/url/resources/urltestdata.json - test/fixtures/wpt/url/resources/setters_tests.json - test/fixtures/wpt/url/resources/toascii.json Also removes dependency of `fixtures/url-tests.js` in http2 tests and use `fixtures/person-large.jpg` instead since they are just looking for a big enough file to transfer. PR-URL: https://github.com/nodejs/node/pull/24035 Refs: https://github.com/nodejs/node/issues/23192 Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
const fixtures = require('../common/fixtures');
|
|
const assert = require('assert');
|
|
const http2 = require('http2');
|
|
const fs = require('fs');
|
|
const net = require('net');
|
|
const path = require('path');
|
|
|
|
// HTTP/2 servers can listen on a named pipe.
|
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
tmpdir.refresh();
|
|
const loc = fixtures.path('person-large.jpg');
|
|
const fn = path.join(tmpdir.path, 'http2-url-tests.js');
|
|
|
|
const server = http2.createServer();
|
|
|
|
server.on('stream', common.mustCall((stream) => {
|
|
const dest = stream.pipe(fs.createWriteStream(fn));
|
|
|
|
dest.on('finish', () => {
|
|
assert.strictEqual(fs.readFileSync(loc).length,
|
|
fs.readFileSync(fn).length);
|
|
});
|
|
stream.respond();
|
|
stream.end();
|
|
}));
|
|
|
|
server.listen(common.PIPE, common.mustCall(() => {
|
|
const client = http2.connect('http://localhost', {
|
|
createConnection(url) {
|
|
return net.connect(server.address());
|
|
}
|
|
});
|
|
|
|
const req = client.request({ ':method': 'POST' });
|
|
req.on('response', common.mustCall());
|
|
req.resume();
|
|
|
|
req.on('close', common.mustCall(() => {
|
|
server.close();
|
|
client.close();
|
|
}));
|
|
|
|
const str = fs.createReadStream(loc);
|
|
str.on('end', common.mustCall());
|
|
str.pipe(req);
|
|
}));
|