summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-padding-callback.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-http2-padding-callback.js')
-rw-r--r--test/parallel/test-http2-padding-callback.js51
1 files changed, 0 insertions, 51 deletions
diff --git a/test/parallel/test-http2-padding-callback.js b/test/parallel/test-http2-padding-callback.js
deleted file mode 100644
index 6d6a6b2722..0000000000
--- a/test/parallel/test-http2-padding-callback.js
+++ /dev/null
@@ -1,51 +0,0 @@
-'use strict';
-
-const common = require('../common');
-if (!common.hasCrypto)
- common.skip('missing crypto');
-const assert = require('assert');
-const h2 = require('http2');
-const { PADDING_STRATEGY_CALLBACK } = h2.constants;
-
-function selectPadding(frameLen, max) {
- assert.strictEqual(typeof frameLen, 'number');
- assert.strictEqual(typeof max, 'number');
- assert(max >= frameLen);
- return max;
-}
-
-// selectPadding will be called three times:
-// 1. For the client request headers frame
-// 2. For the server response headers frame
-// 3. For the server response data frame
-const options = {
- paddingStrategy: PADDING_STRATEGY_CALLBACK,
- selectPadding: common.mustCall(selectPadding, 3)
-};
-
-const server = h2.createServer(options);
-server.on('stream', common.mustCall(onStream));
-
-function onStream(stream, headers, flags) {
- stream.respond({
- 'content-type': 'text/html',
- ':status': 200
- });
- stream.end('hello world');
-}
-
-server.listen(0);
-
-server.on('listening', common.mustCall(() => {
- const client = h2.connect(`http://localhost:${server.address().port}`,
- options);
-
- const req = client.request({ ':path': '/' });
- req.on('response', common.mustCall());
- req.resume();
- req.on('end', common.mustCall(() => {
- server.close();
- client.close();
- }));
- req.end();
-}));