2017-07-17 10:29:42 -07:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
2017-08-07 07:54:44 +02:00
|
|
|
if (!common.hasCrypto)
|
|
|
|
common.skip('missing crypto');
|
2017-07-17 10:29:42 -07:00
|
|
|
const h2 = require('http2');
|
|
|
|
|
2025-06-03 11:09:40 +02:00
|
|
|
common.expectWarning(
|
|
|
|
'DeprecationWarning',
|
2025-06-11 21:47:31 +08:00
|
|
|
'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 9113',
|
2025-06-03 11:09:40 +02:00
|
|
|
'DEP0194');
|
|
|
|
|
2017-07-17 10:29:42 -07:00
|
|
|
const server = h2.createServer();
|
|
|
|
|
2019-03-07 01:03:53 +01:00
|
|
|
// We use the lower-level API here
|
2017-12-12 11:34:17 -08:00
|
|
|
server.on('stream', common.mustCall((stream) => {
|
|
|
|
stream.respond();
|
|
|
|
stream.end('ok');
|
|
|
|
}));
|
2017-07-17 10:29:42 -07:00
|
|
|
|
2017-12-12 11:34:17 -08:00
|
|
|
server.listen(0, common.mustCall(() => {
|
2017-07-17 10:29:42 -07:00
|
|
|
const client = h2.connect(`http://localhost:${server.address().port}`);
|
2017-12-12 11:34:17 -08:00
|
|
|
const req = client.request();
|
2017-11-15 10:55:31 -08:00
|
|
|
req.priority({});
|
2017-07-17 10:29:42 -07:00
|
|
|
|
|
|
|
req.on('response', common.mustCall());
|
|
|
|
req.resume();
|
2017-12-12 11:34:17 -08:00
|
|
|
req.on('end', common.mustCall());
|
|
|
|
req.on('close', common.mustCall(() => {
|
2017-07-17 10:29:42 -07:00
|
|
|
server.close();
|
2017-12-12 11:34:17 -08:00
|
|
|
client.close();
|
2017-07-17 10:29:42 -07:00
|
|
|
}));
|
|
|
|
}));
|