diff --git a/benchmark/quic/h3-request.js b/benchmark/quic/h3-request.js index f96a18407ae1..3b61a81d069b 100644 --- a/benchmark/quic/h3-request.js +++ b/benchmark/quic/h3-request.js @@ -69,7 +69,7 @@ async function main({ mode, n }) { alpn: 'h3', ...resume, }); - const stream = await session.createBidirectionalStream({ + const stream = session.createBidirectionalStream({ headers: request, onheaders, }); @@ -121,7 +121,7 @@ async function main({ mode, n }) { alpn: 'h3', ...resume, }); - const stream = await session.createBidirectionalStream({ + const stream = session.createBidirectionalStream({ headers: request, onheaders, }); diff --git a/doc/api/quic.md b/doc/api/quic.md index d977f7e03ad2..234be7238cf2 100644 --- a/doc/api/quic.md +++ b/doc/api/quic.md @@ -491,7 +491,7 @@ import { Buffer } from 'node:buffer'; const enc = new TextEncoder(); const alpn = 'foo'; const client = await connect('123.123.123.123:8888', { alpn }); -await client.createUnidirectionalStream({ +client.createUnidirectionalStream({ body: enc.encode('hello world'), }); ``` @@ -1365,11 +1365,11 @@ added: v23.8.0 will buffer before `writeSync()` returns `false`. When the buffered data exceeds this limit, the caller should wait for drain before writing more. **Default:** `65536` (64 KB). - * `waitUntilAvailable` {boolean} When true the promise will wait until flow - control will allow to open the stream. If set to false, the function - will return a rejected promise, if flow control will not allow to - open the stream immediately. - **Default:** `true` + * `waitUntilAvailable` {boolean} When `true`, a stream that cannot be + opened immediately (because the handshake has not yet completed or the + peer's stream limit has been reached) is returned as a pending stream, + and is opened once that becomes possible. When `false`, an error is + thrown instead of creating a pending stream. **Default:** `true`. * `onheaders` {Function} Callback for received initial response headers. Called with `(headers)`. * `ontrailers` {Function} Callback for received trailing headers. @@ -1379,7 +1379,7 @@ added: v23.8.0 * `onwanttrailers` {Function} Callback when trailers should be sent. Called with no arguments; use [`stream.sendTrailers()`][] within the callback. -* Returns: {Promise} for a {quic.QuicStream} +* Returns: {quic.QuicStream} Open a new bidirectional stream. If the `body` option is not specified, the stream's outgoing side remains writable and no FIN is sent @@ -1388,6 +1388,10 @@ options are only used when the session supports priority (e.g. HTTP/3). The `headers`, `onheaders`, `ontrailers`, `oninfo`, and `onwanttrailers` options are only used when the session supports headers (e.g. HTTP/3). +The stream is returned synchronously. If it cannot be opened immediately, it +is returned as a pending stream, with further operations queued until the +stream opens. See [`stream.pending`][]. + ### `session.createUnidirectionalStream([options])` + +* Type: {boolean} + +`true` if the stream has been created locally but not yet opened, either +because the handshake has not yet completed or because the peer's stream limit +has been reached. Read only. + +While a stream is pending, [`stream.id`][] is `null`. Once it is opened, +[`stream.opened`][] is fulfilled. A pending stream can be used like any other +stream; its body and headers are queued until it is opened. ### `stream.closed` @@ -4213,7 +4236,7 @@ const session = await connect('example.com:443', { }); await session.opened; -const stream = await session.createBidirectionalStream({ +const stream = session.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', @@ -4909,9 +4932,12 @@ throughput issues caused by flow control. [`sessionOptions.truncatedReads`]: #sessionoptionstruncatedreads [`stream.destroy()`]: #streamdestroyerror-options [`stream.headers`]: #streamheaders +[`stream.id`]: #streamid [`stream.onerror`]: #streamonerror [`stream.onwanttrailers`]: #streamonwanttrailers +[`stream.opened`]: #streamopened [`stream.pendingTrailers`]: #streampendingtrailers +[`stream.pending`]: #streampending [`stream.priority`]: #streampriority [`stream.resetStream()`]: #streamresetstreamcode [`stream.sendHeaders()`]: #streamsendheadersheaders-options diff --git a/lib/internal/quic/quic.js b/lib/internal/quic/quic.js index 92942c26e17b..204b49b1dfbe 100644 --- a/lib/internal/quic/quic.js +++ b/lib/internal/quic/quic.js @@ -299,6 +299,9 @@ const endpointRegistry = new SafeSet(); * @property {boolean} [incremental] Whether to interleave data with same-priority streams. * @property {number} [budget] The byte budget for write backpressure. * **Default:** `65536`. + * @property {boolean} [waitUntilAvailable] When false, throw rather than + * creating a pending stream if the stream cannot be opened immediately. + * **Default:** `true`. * @property {OnHeadersCallback} [onheaders] Callback for incoming initial headers * @property {OnTrailersCallback} [ontrailers] Callback for incoming trailing headers * @property {OnInfoCallback} [oninfo] Callback for informational (1xx) headers @@ -3209,16 +3212,16 @@ class QuicSession { * @param {OpenStreamOptions} options * @returns {QuicStream} */ - async #createStream(direction, options = kEmptyObject) { + #createStream(direction, options = kEmptyObject) { const inner = this.#inner; if (this.#isClosedOrClosing) { throw new ERR_INVALID_STATE('Session is closed. New streams cannot be opened.'); } const dir = direction === kStreamDirectionBidirectional ? 'bidi' : 'uni'; if (inner.state.isStreamOpenAllowed) { - debug(`opening new pending ${dir} stream`); - } else { debug(`opening new ${dir} stream`); + } else { + debug(`opening new pending ${dir} stream`); } validateObject(options, 'options'); @@ -3291,23 +3294,27 @@ class QuicSession { /** * Creates a new bidirectional stream on this session. If the session * does not allow new streams to be opened, an error will be thrown. + * If the stream cannot be opened on the wire yet, it is returned in a + * pending state. * @param {OpenStreamOptions} [options] - * @returns {Promise} + * @returns {QuicStream} */ - async createBidirectionalStream(options = kEmptyObject) { + createBidirectionalStream(options = kEmptyObject) { assertIsQuicSession(this); - return await this.#createStream(kStreamDirectionBidirectional, options); + return this.#createStream(kStreamDirectionBidirectional, options); } /** * Creates a new unidirectional stream on this session. If the session * does not allow new streams to be opened, an error will be thrown. + * If the stream cannot be opened on the wire yet, it is returned in a + * pending state. * @param {OpenStreamOptions} [options] - * @returns {Promise} + * @returns {QuicStream} */ - async createUnidirectionalStream(options = kEmptyObject) { + createUnidirectionalStream(options = kEmptyObject) { assertIsQuicSession(this); - return await this.#createStream(kStreamDirectionUnidirectional, options); + return this.#createStream(kStreamDirectionUnidirectional, options); } /** diff --git a/test/common/quic.mjs b/test/common/quic.mjs index 72effd8b6528..1e9ec0f3871e 100644 --- a/test/common/quic.mjs +++ b/test/common/quic.mjs @@ -145,7 +145,7 @@ async function readStream(serverBody, options = {}) { await session.opened; session.closed.catch(() => {}); - const stream = await session.createBidirectionalStream(); + const stream = session.createBidirectionalStream(); await stream.writer.write(new Uint8Array([1])); let closedError; diff --git a/test/parallel/test-quic-callback-error-onblocked.mjs b/test/parallel/test-quic-callback-error-onblocked.mjs index 88a22ee2f683..373053fece71 100644 --- a/test/parallel/test-quic-callback-error-onblocked.mjs +++ b/test/parallel/test-quic-callback-error-onblocked.mjs @@ -30,7 +30,7 @@ const clientSession = await connect(serverEndpoint.address, { }); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.onblocked = mustCall(() => { throw testError; diff --git a/test/parallel/test-quic-callback-error-onerror-validation.mjs b/test/parallel/test-quic-callback-error-onerror-validation.mjs index 61a4219e2f23..87d894d6de60 100644 --- a/test/parallel/test-quic-callback-error-onerror-validation.mjs +++ b/test/parallel/test-quic-callback-error-onerror-validation.mjs @@ -41,7 +41,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Client-side stream onerror validation. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: new TextEncoder().encode('x'), }); diff --git a/test/parallel/test-quic-callback-error-onreset.mjs b/test/parallel/test-quic-callback-error-onreset.mjs index 56af714505c9..ee4d70bc0be5 100644 --- a/test/parallel/test-quic-callback-error-onreset.mjs +++ b/test/parallel/test-quic-callback-error-onreset.mjs @@ -42,7 +42,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('trigger onstream'), }); diff --git a/test/parallel/test-quic-callback-error-onstream-async.mjs b/test/parallel/test-quic-callback-error-onstream-async.mjs index 13b5f4dd7555..683f521dd771 100644 --- a/test/parallel/test-quic-callback-error-onstream-async.mjs +++ b/test/parallel/test-quic-callback-error-onstream-async.mjs @@ -34,7 +34,7 @@ const clientSession = await connect(serverEndpoint.address, { }); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: new TextEncoder().encode('trigger onstream'), }); diff --git a/test/parallel/test-quic-callback-error-onstream.mjs b/test/parallel/test-quic-callback-error-onstream.mjs index 729e301134b9..e9fdbdcd8658 100644 --- a/test/parallel/test-quic-callback-error-onstream.mjs +++ b/test/parallel/test-quic-callback-error-onstream.mjs @@ -37,7 +37,7 @@ const clientSession = await connect(serverEndpoint.address, { await clientSession.opened; // Send data to trigger onstream on the server. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('trigger onstream'), }); diff --git a/test/parallel/test-quic-callback-error-stream-onerror.mjs b/test/parallel/test-quic-callback-error-stream-onerror.mjs index 5cc0edc6fe1e..5997607fb041 100644 --- a/test/parallel/test-quic-callback-error-stream-onerror.mjs +++ b/test/parallel/test-quic-callback-error-stream-onerror.mjs @@ -39,7 +39,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; { - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: encoder.encode('will error'), }); @@ -65,7 +65,7 @@ await clientSession.opened; // Create a stream with no body — use the writer API so the server sees // it and can close cleanly. { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const w = stream.writer; stream.onerror = mustNotCall('stream.onerror should not be called'); diff --git a/test/parallel/test-quic-cc-algorithm.mjs b/test/parallel/test-quic-cc-algorithm.mjs index 0de377c15868..78f2eb9d95ef 100644 --- a/test/parallel/test-quic-cc-algorithm.mjs +++ b/test/parallel/test-quic-cc-algorithm.mjs @@ -36,7 +36,7 @@ for (const cc of ['reno', 'cubic', 'bbr']) { const clientSession = await connect(serverEndpoint.address, { cc }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: encoder.encode('congestion control test'), }); diff --git a/test/parallel/test-quic-connection-concurrent.mjs b/test/parallel/test-quic-connection-concurrent.mjs index d9f9f253ed3b..9b6d8ec3a5ad 100644 --- a/test/parallel/test-quic-connection-concurrent.mjs +++ b/test/parallel/test-quic-connection-concurrent.mjs @@ -39,7 +39,7 @@ for (let i = 0; i < numClients; i++) { const cs = await connect(serverEndpoint.address, { reuseEndpoint: false }); await cs.opened; const message = `client ${i}`; - const stream = await cs.createBidirectionalStream({ + const stream = cs.createBidirectionalStream({ body: encoder.encode(message), }); const received = await bytes(stream); diff --git a/test/parallel/test-quic-datagram-multiple.mjs b/test/parallel/test-quic-datagram-multiple.mjs index 28f34a28664c..cc45bf793a09 100644 --- a/test/parallel/test-quic-datagram-multiple.mjs +++ b/test/parallel/test-quic-datagram-multiple.mjs @@ -63,7 +63,7 @@ await clientSession.opened; // Open a stream FIRST to establish bidirectional traffic. // This ensures ACKs flow back from the server, keeping the // congestion window open for subsequent datagram sends. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: new TextEncoder().encode('hello'), }); diff --git a/test/parallel/test-quic-default-stream-limits.mjs b/test/parallel/test-quic-default-stream-limits.mjs index be1ec5bf3e67..62eadaeec1b1 100644 --- a/test/parallel/test-quic-default-stream-limits.mjs +++ b/test/parallel/test-quic-default-stream-limits.mjs @@ -34,11 +34,11 @@ assert.ok(info, 'handshake info should be available'); // Check that the session has reasonable default stream limits by // verifying we can create at least one bidirectional and one // unidirectional stream. -const bidiStream = await clientSession.createBidirectionalStream(); +const bidiStream = clientSession.createBidirectionalStream(); assert.ok(bidiStream, 'should be able to create a bidi stream'); bidiStream.destroy(); -const uniStream = await clientSession.createUnidirectionalStream(); +const uniStream = clientSession.createUnidirectionalStream(); assert.ok(uniStream, 'should be able to create a uni stream'); uniStream.destroy(); diff --git a/test/parallel/test-quic-diagnostics-channel-stream.mjs b/test/parallel/test-quic-diagnostics-channel-stream.mjs index 0a77d9238feb..47f22960144d 100644 --- a/test/parallel/test-quic-diagnostics-channel-stream.mjs +++ b/test/parallel/test-quic-diagnostics-channel-stream.mjs @@ -56,7 +56,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('diagnostics test'), }); diff --git a/test/parallel/test-quic-early-selection-order.mjs b/test/parallel/test-quic-early-selection-order.mjs index f7cc89fb04c0..c6e9a020c2b4 100644 --- a/test/parallel/test-quic-early-selection-order.mjs +++ b/test/parallel/test-quic-early-selection-order.mjs @@ -60,7 +60,7 @@ const decoder = new TextDecoder(); }); await cs1.opened; await Promise.all([gotTicket.promise, gotToken.promise]); - const s1 = await cs1.createBidirectionalStream({ + const s1 = cs1.createBidirectionalStream({ headers: request, onheaders: mustCall(), }); @@ -76,7 +76,7 @@ const decoder = new TextDecoder(); }); // Send a 0RTT request immediately, before the handshake completes: - const s2 = await cs2.createBidirectionalStream({ + const s2 = cs2.createBidirectionalStream({ headers: request, onheaders: mustCall(), }); diff --git a/test/parallel/test-quic-edge-closing-ops.mjs b/test/parallel/test-quic-edge-closing-ops.mjs index f5da250cb8c8..961155553964 100644 --- a/test/parallel/test-quic-edge-closing-ops.mjs +++ b/test/parallel/test-quic-edge-closing-ops.mjs @@ -27,14 +27,14 @@ await clientSession.opened; // Initiate graceful close. clientSession.close(); -// Creating a stream on a closing session rejects. -await assert.rejects( - clientSession.createBidirectionalStream(), +// Creating a stream on a closing session throws. +assert.throws( + () => clientSession.createBidirectionalStream(), { code: 'ERR_INVALID_STATE' }, ); -await assert.rejects( - clientSession.createUnidirectionalStream(), +assert.throws( + () => clientSession.createUnidirectionalStream(), { code: 'ERR_INVALID_STATE' }, ); diff --git a/test/parallel/test-quic-edge-concurrent-close.mjs b/test/parallel/test-quic-edge-concurrent-close.mjs index 120ab0ccafbd..49dcd244344e 100644 --- a/test/parallel/test-quic-edge-concurrent-close.mjs +++ b/test/parallel/test-quic-edge-concurrent-close.mjs @@ -29,7 +29,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Open a stream so the server session has work, then close from both sides. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.writer.endSync(); for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars await stream.closed; diff --git a/test/parallel/test-quic-edge-destroyed-ops.mjs b/test/parallel/test-quic-edge-destroyed-ops.mjs index b109a3ca998d..b6614f00c594 100644 --- a/test/parallel/test-quic-edge-destroyed-ops.mjs +++ b/test/parallel/test-quic-edge-destroyed-ops.mjs @@ -20,7 +20,7 @@ const serverEndpoint = await listen(mustCall(async (serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); // Destroy the stream, then try operations on it. stream.destroy(); diff --git a/test/parallel/test-quic-edge-endpoint-destroy-active.mjs b/test/parallel/test-quic-edge-endpoint-destroy-active.mjs index e5d40a12ae5f..192ed04a2889 100644 --- a/test/parallel/test-quic-edge-endpoint-destroy-active.mjs +++ b/test/parallel/test-quic-edge-endpoint-destroy-active.mjs @@ -32,7 +32,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Create a stream so there's active work. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('hello'), }); for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars diff --git a/test/parallel/test-quic-edge-idempotent.mjs b/test/parallel/test-quic-edge-idempotent.mjs index 1781a7b624a1..ba44c31ec01a 100644 --- a/test/parallel/test-quic-edge-idempotent.mjs +++ b/test/parallel/test-quic-edge-idempotent.mjs @@ -27,7 +27,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Signal server to close via stream first (before we close). -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.writer.endSync(); for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars await stream.closed; diff --git a/test/parallel/test-quic-endpoint-close-destroy.mjs b/test/parallel/test-quic-endpoint-close-destroy.mjs index 07244ead3049..8ff2b8375c63 100644 --- a/test/parallel/test-quic-endpoint-close-destroy.mjs +++ b/test/parallel/test-quic-endpoint-close-destroy.mjs @@ -65,7 +65,7 @@ const encoder = new TextEncoder(); await clientSession.opened; // Send some data so the server session has work to do. - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: encoder.encode('test'), }); diff --git a/test/parallel/test-quic-flow-control-bidi-simultaneous-volume.mjs b/test/parallel/test-quic-flow-control-bidi-simultaneous-volume.mjs index 24919cea1181..4ab2b79ca960 100644 --- a/test/parallel/test-quic-flow-control-bidi-simultaneous-volume.mjs +++ b/test/parallel/test-quic-flow-control-bidi-simultaneous-volume.mjs @@ -84,7 +84,7 @@ const clientSession = await connect(serverEndpoint.address, { }); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(toServer); // Read the server's payload while our own body is still being sent. diff --git a/test/parallel/test-quic-flow-control-blob.mjs b/test/parallel/test-quic-flow-control-blob.mjs index 9531f1ee5b6b..b8e2fb61326d 100644 --- a/test/parallel/test-quic-flow-control-blob.mjs +++ b/test/parallel/test-quic-flow-control-blob.mjs @@ -39,7 +39,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: blob, }); diff --git a/test/parallel/test-quic-flow-control-block-resume.mjs b/test/parallel/test-quic-flow-control-block-resume.mjs index 1de68aa27c6e..cbc2e46c546d 100644 --- a/test/parallel/test-quic-flow-control-block-resume.mjs +++ b/test/parallel/test-quic-flow-control-block-resume.mjs @@ -41,7 +41,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(data); await dump(stream); diff --git a/test/parallel/test-quic-flow-control-concurrent-volume.mjs b/test/parallel/test-quic-flow-control-concurrent-volume.mjs index b3f2c9a62450..74793cdfa7a1 100644 --- a/test/parallel/test-quic-flow-control-concurrent-volume.mjs +++ b/test/parallel/test-quic-flow-control-concurrent-volume.mjs @@ -106,7 +106,7 @@ await clientSession.opened; // for the shared connection window rather than running one after another. const streams = []; for (let i = 0; i < kStreams; i++) { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(payloads[i]); streams.push(stream); } diff --git a/test/parallel/test-quic-flow-control-credit-reclaim.mjs b/test/parallel/test-quic-flow-control-credit-reclaim.mjs index f5dcedad1cce..05df5f1d9b1d 100644 --- a/test/parallel/test-quic-flow-control-credit-reclaim.mjs +++ b/test/parallel/test-quic-flow-control-credit-reclaim.mjs @@ -57,7 +57,7 @@ const clientSession = await connect(serverEndpoint.address, { await clientSession.opened; for (let i = 0; i < kStreamCount; i++) { - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: encoder.encode('request'), }); @@ -80,7 +80,7 @@ for (let i = 0; i < kStreamCount; i++) { // above. Verify the session is still healthy and able to move data, which // confirms the window was replenished rather than merely limping along. { - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: encoder.encode('request'), }); let received = 0; diff --git a/test/parallel/test-quic-flow-control-large-constrained.mjs b/test/parallel/test-quic-flow-control-large-constrained.mjs index db73141528b1..2ad22e133bdb 100644 --- a/test/parallel/test-quic-flow-control-large-constrained.mjs +++ b/test/parallel/test-quic-flow-control-large-constrained.mjs @@ -75,7 +75,7 @@ const windowCaps = { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); // Assert the sender actually hit the window. Without this the test could // pass trivially if the windows were silently widened, and we would lose @@ -111,7 +111,7 @@ const windowCaps = { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; - const stream = await clientSession.createUnidirectionalStream(); + const stream = clientSession.createUnidirectionalStream(); stream.onblocked = mustCallAtLeast(1); stream.setBody(payload); diff --git a/test/parallel/test-quic-flow-control-params.mjs b/test/parallel/test-quic-flow-control-params.mjs index 3827a1404a80..f770be9a5227 100644 --- a/test/parallel/test-quic-flow-control-params.mjs +++ b/test/parallel/test-quic-flow-control-params.mjs @@ -48,7 +48,7 @@ const encoder = new TextEncoder(); const clientSession = await connect(serverEndpoint.address); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ budget: 512, }); const w = stream.writer; diff --git a/test/parallel/test-quic-flow-control-slow-consumer-volume.mjs b/test/parallel/test-quic-flow-control-slow-consumer-volume.mjs index 52e6a92512ef..566ba6c0ee59 100644 --- a/test/parallel/test-quic-flow-control-slow-consumer-volume.mjs +++ b/test/parallel/test-quic-flow-control-slow-consumer-volume.mjs @@ -79,7 +79,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); // The sender must actually hit the window, otherwise the consumer was not // slow relative to the sender and the ceiling below proves nothing. stream.onblocked = mustCallAtLeast(1); diff --git a/test/parallel/test-quic-flow-control-uni.mjs b/test/parallel/test-quic-flow-control-uni.mjs index f77744937470..9e431746bac3 100644 --- a/test/parallel/test-quic-flow-control-uni.mjs +++ b/test/parallel/test-quic-flow-control-uni.mjs @@ -36,7 +36,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createUnidirectionalStream({ +const stream = clientSession.createUnidirectionalStream({ budget: 512, }); const w = stream.writer; diff --git a/test/parallel/test-quic-h3-callback-errors.mjs b/test/parallel/test-quic-h3-callback-errors.mjs index be8ed391b8d5..e35807c3beed 100644 --- a/test/parallel/test-quic-h3-callback-errors.mjs +++ b/test/parallel/test-quic-h3-callback-errors.mjs @@ -58,7 +58,7 @@ async function makeServer(onheadersHandler, extraOpts = {}) { }); await c.opened; - const s = await c.createBidirectionalStream({ + const s = c.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', @@ -98,7 +98,7 @@ async function makeServer(onheadersHandler, extraOpts = {}) { }); await c.opened; - const s = await c.createBidirectionalStream({ + const s = c.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', @@ -143,7 +143,7 @@ async function makeServer(onheadersHandler, extraOpts = {}) { }); await c.opened; - const s = await c.createBidirectionalStream({ + const s = c.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', @@ -198,7 +198,7 @@ async function makeServer(onheadersHandler, extraOpts = {}) { }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', @@ -257,7 +257,7 @@ async function makeServer(onheadersHandler, extraOpts = {}) { }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', diff --git a/test/parallel/test-quic-h3-close-behavior.mjs b/test/parallel/test-quic-h3-close-behavior.mjs index e3b73ce9b0b9..ab309654913c 100644 --- a/test/parallel/test-quic-h3-close-behavior.mjs +++ b/test/parallel/test-quic-h3-close-behavior.mjs @@ -54,7 +54,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream1 = await clientSession.createBidirectionalStream({ + const stream1 = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/one', @@ -66,7 +66,7 @@ const decoder = new TextDecoder(); }), }); - const stream2 = await clientSession.createBidirectionalStream({ + const stream2 = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/two', diff --git a/test/parallel/test-quic-h3-concurrent-requests.mjs b/test/parallel/test-quic-h3-concurrent-requests.mjs index 5bd5635008ca..858127cf6862 100644 --- a/test/parallel/test-quic-h3-concurrent-requests.mjs +++ b/test/parallel/test-quic-h3-concurrent-requests.mjs @@ -64,7 +64,7 @@ const paths = Array.from({ length: REQUEST_COUNT }, (_, i) => `/path/${i}`); const requests = paths.map(mustCall(async (path) => { const headersReceived = Promise.withResolvers(); - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': path, diff --git a/test/parallel/test-quic-h3-datagram.mjs b/test/parallel/test-quic-h3-datagram.mjs index 38aeb971c8fe..d2e7f8fbbdfd 100644 --- a/test/parallel/test-quic-h3-datagram.mjs +++ b/test/parallel/test-quic-h3-datagram.mjs @@ -79,7 +79,7 @@ const decoder = new TextDecoder(); await clientSession.opened; // Datagrams work alongside H3 request/response. - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/with-datagram', @@ -143,7 +143,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/no-datagram', diff --git a/test/parallel/test-quic-h3-error-codes.mjs b/test/parallel/test-quic-h3-error-codes.mjs index 46b7db008662..4c6a3cacaa8c 100644 --- a/test/parallel/test-quic-h3-error-codes.mjs +++ b/test/parallel/test-quic-h3-error-codes.mjs @@ -47,7 +47,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', @@ -98,7 +98,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', @@ -142,7 +142,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', @@ -184,7 +184,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', diff --git a/test/parallel/test-quic-h3-error-name.mjs b/test/parallel/test-quic-h3-error-name.mjs index 811bc933ab90..89f15dc43928 100644 --- a/test/parallel/test-quic-h3-error-name.mjs +++ b/test/parallel/test-quic-h3-error-name.mjs @@ -48,7 +48,7 @@ async function receiveCloseError(closeOptions) { ); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', diff --git a/test/parallel/test-quic-h3-flow-control-volume.mjs b/test/parallel/test-quic-h3-flow-control-volume.mjs index e422d1a411ad..a68fe27db5ee 100644 --- a/test/parallel/test-quic-h3-flow-control-volume.mjs +++ b/test/parallel/test-quic-h3-flow-control-volume.mjs @@ -94,7 +94,7 @@ assert.strictEqual(info.protocol, 'h3'); const headersReceived = Promise.withResolvers(); -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'POST', ':path': '/upload', diff --git a/test/parallel/test-quic-h3-goaway-non-h3.mjs b/test/parallel/test-quic-h3-goaway-non-h3.mjs index f61df78da9e8..b7145d096477 100644 --- a/test/parallel/test-quic-h3-goaway-non-h3.mjs +++ b/test/parallel/test-quic-h3-goaway-non-h3.mjs @@ -49,7 +49,7 @@ const clientSession = await connect(serverEndpoint.address, { }); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('ping'), }); diff --git a/test/parallel/test-quic-h3-goaway.mjs b/test/parallel/test-quic-h3-goaway.mjs index bb0bf8e966c1..e88eddff9f5c 100644 --- a/test/parallel/test-quic-h3-goaway.mjs +++ b/test/parallel/test-quic-h3-goaway.mjs @@ -84,7 +84,7 @@ dc.subscribe('quic.session.goaway', mustCall((msg) => { } }, 2); - const stream1 = await clientSession.createBidirectionalStream({ + const stream1 = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/first', @@ -94,7 +94,7 @@ dc.subscribe('quic.session.goaway', mustCall((msg) => { onheaders: onClientHeaders, }); - const stream2 = await clientSession.createBidirectionalStream({ + const stream2 = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/second', @@ -121,8 +121,8 @@ dc.subscribe('quic.session.goaway', mustCall((msg) => { await goawayReceived.promise; // After GOAWAY, new stream creation should fail. - await assert.rejects( - clientSession.createBidirectionalStream({ + assert.throws( + () => clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/new', diff --git a/test/parallel/test-quic-h3-header-interest.mjs b/test/parallel/test-quic-h3-header-interest.mjs index 4fe05b6f6d3e..ec554d88674c 100644 --- a/test/parallel/test-quic-h3-header-interest.mjs +++ b/test/parallel/test-quic-h3-header-interest.mjs @@ -50,7 +50,7 @@ await clientSession.opened; const infoReceived = Promise.withResolvers(); const trailersReceived = Promise.withResolvers(); -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', diff --git a/test/parallel/test-quic-h3-header-validation.mjs b/test/parallel/test-quic-h3-header-validation.mjs index a75a884c39b9..134a35d5c245 100644 --- a/test/parallel/test-quic-h3-header-validation.mjs +++ b/test/parallel/test-quic-h3-header-validation.mjs @@ -78,7 +78,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { // Mixed-case names — should be lowercased by buildNgHeaderString. ':method': 'GET', @@ -140,7 +140,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'POST', ':path': '/api/data', diff --git a/test/parallel/test-quic-h3-headers-support.mjs b/test/parallel/test-quic-h3-headers-support.mjs index 5a8c426801c9..ac20ea4e9b27 100644 --- a/test/parallel/test-quic-h3-headers-support.mjs +++ b/test/parallel/test-quic-h3-headers-support.mjs @@ -63,7 +63,7 @@ const clientSession = await connect(serverEndpoint.address, { }); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('ping'), }); diff --git a/test/parallel/test-quic-h3-informational-headers.mjs b/test/parallel/test-quic-h3-informational-headers.mjs index 357b507ae0db..cfc29439609a 100644 --- a/test/parallel/test-quic-h3-informational-headers.mjs +++ b/test/parallel/test-quic-h3-informational-headers.mjs @@ -81,7 +81,7 @@ await clientSession.opened; const clientInfoReceived = Promise.withResolvers(); const clientHeadersReceived = Promise.withResolvers(); -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/page', diff --git a/test/parallel/test-quic-h3-maxstreamdata-external-buffer-failure.mjs b/test/parallel/test-quic-h3-maxstreamdata-external-buffer-failure.mjs index e8d849243ac8..bdb9fb0cbdc2 100644 --- a/test/parallel/test-quic-h3-maxstreamdata-external-buffer-failure.mjs +++ b/test/parallel/test-quic-h3-maxstreamdata-external-buffer-failure.mjs @@ -53,7 +53,7 @@ const session = await connect(endpoint.address, { await session.opened; // Budget well above the window, so the window is what stops the writer. -const stream = await session.createBidirectionalStream({ budget: 1024 * 1024 }); +const stream = session.createBidirectionalStream({ budget: 1024 * 1024 }); stream.sendHeaders({ ':method': 'POST', ':path': '/', diff --git a/test/parallel/test-quic-h3-origin.mjs b/test/parallel/test-quic-h3-origin.mjs index 9f80449b6b65..df55168fc72c 100644 --- a/test/parallel/test-quic-h3-origin.mjs +++ b/test/parallel/test-quic-h3-origin.mjs @@ -69,7 +69,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', @@ -165,7 +165,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', diff --git a/test/parallel/test-quic-h3-pending-stream.mjs b/test/parallel/test-quic-h3-pending-stream.mjs index a6e9c8cfd912..297a66710bf3 100644 --- a/test/parallel/test-quic-h3-pending-stream.mjs +++ b/test/parallel/test-quic-h3-pending-stream.mjs @@ -53,7 +53,7 @@ const decoder = new TextDecoder(); // Create the stream BEFORE awaiting opened. The stream is pending // until the handshake completes and the QUIC stream can be opened. - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/pending', diff --git a/test/parallel/test-quic-h3-post-filehandle.mjs b/test/parallel/test-quic-h3-post-filehandle.mjs index a4c583463d24..ab928bb0a4c2 100644 --- a/test/parallel/test-quic-h3-post-filehandle.mjs +++ b/test/parallel/test-quic-h3-post-filehandle.mjs @@ -67,7 +67,7 @@ writeFileSync(testFile, testContent); const clientHeadersReceived = Promise.withResolvers(); const fh = await open(testFile, 'r'); - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'POST', ':path': '/upload', diff --git a/test/parallel/test-quic-h3-post-request.mjs b/test/parallel/test-quic-h3-post-request.mjs index c5d9635a640c..750e4273c52b 100644 --- a/test/parallel/test-quic-h3-post-request.mjs +++ b/test/parallel/test-quic-h3-post-request.mjs @@ -75,7 +75,7 @@ const clientHeadersReceived = Promise.withResolvers(); // Send a POST request with body. When body is provided, terminal is NOT // set on the HEADERS frame (body follows). -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'POST', ':path': '/submit', diff --git a/test/parallel/test-quic-h3-priority.mjs b/test/parallel/test-quic-h3-priority.mjs index 10be3d6f216e..4eda92e4305a 100644 --- a/test/parallel/test-quic-h3-priority.mjs +++ b/test/parallel/test-quic-h3-priority.mjs @@ -57,7 +57,7 @@ const decoder = new TextDecoder(); await clientSession.opened; // Priority set at creation time via options. - const stream1 = await clientSession.createBidirectionalStream({ + const stream1 = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/high', @@ -75,7 +75,7 @@ const decoder = new TextDecoder(); assert.deepStrictEqual(stream1.priority, { level: 'high', incremental: false }); // Priority 'low' + incremental at creation. - const stream2 = await clientSession.createBidirectionalStream({ + const stream2 = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/low-inc', @@ -91,7 +91,7 @@ const decoder = new TextDecoder(); assert.deepStrictEqual(stream2.priority, { level: 'low', incremental: true }); // Default priority at creation. - const stream3 = await clientSession.createBidirectionalStream({ + const stream3 = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/default', @@ -105,7 +105,7 @@ const decoder = new TextDecoder(); assert.deepStrictEqual(stream3.priority, { level: 'default', incremental: false }); // setPriority after creation. - const stream4 = await clientSession.createBidirectionalStream({ + const stream4 = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/changed', @@ -206,7 +206,7 @@ const decoder = new TextDecoder(); // because the stream handle is needed. But the PRIORITY_UPDATE // travels on the control stream which nghttp3 processes before // bidi stream data, so the ordering is guaranteed. - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'POST', ':path': '/pri-update', diff --git a/test/parallel/test-quic-h3-qpack-settings.mjs b/test/parallel/test-quic-h3-qpack-settings.mjs index f30b7163cf6b..a20ad30bb8d7 100644 --- a/test/parallel/test-quic-h3-qpack-settings.mjs +++ b/test/parallel/test-quic-h3-qpack-settings.mjs @@ -27,7 +27,7 @@ const encoder = new TextEncoder(); const decoder = new TextDecoder(); async function makeRequest(clientSession, path) { - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': path, diff --git a/test/parallel/test-quic-h3-request-rejected.mjs b/test/parallel/test-quic-h3-request-rejected.mjs index 6ed987b395af..d5d87213dc60 100644 --- a/test/parallel/test-quic-h3-request-rejected.mjs +++ b/test/parallel/test-quic-h3-request-rejected.mjs @@ -38,7 +38,7 @@ const clientSession = await connect(serverEndpoint.address, { await clientSession.opened; const reset = Promise.withResolvers(); -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/test', diff --git a/test/parallel/test-quic-h3-request-response.mjs b/test/parallel/test-quic-h3-request-response.mjs index cde16684d7e9..c3ab4aa06c61 100644 --- a/test/parallel/test-quic-h3-request-response.mjs +++ b/test/parallel/test-quic-h3-request-response.mjs @@ -85,7 +85,7 @@ const clientHeadersReceived = Promise.withResolvers(); // Send a GET request. With body omitted, the terminal flag is set // automatically (END_STREAM on the HEADERS frame). -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/index.html', diff --git a/test/parallel/test-quic-h3-reset-after-headers.mjs b/test/parallel/test-quic-h3-reset-after-headers.mjs index 1f1d7bced60f..279fc4a993fc 100644 --- a/test/parallel/test-quic-h3-reset-after-headers.mjs +++ b/test/parallel/test-quic-h3-reset-after-headers.mjs @@ -67,7 +67,7 @@ for (const [label, abandon] of cases) { await clientSession.opened; // The first request is abandoned with H3_REQUEST_CANCELLED. - const abandoned = await request(clientSession, '/abandon'); + const abandoned = request(clientSession, '/abandon'); abandoned.onerror = () => {}; const reset = Promise.withResolvers(); abandoned.onreset = mustCall((error) => reset.resolve(error)); @@ -75,7 +75,7 @@ for (const [label, abandon] of cases) { assert.strictEqual(error?.errorCode, H3_REQUEST_CANCELLED, label); // The session still works: a second request gets a response. - const ok = await request(clientSession, '/ok'); + const ok = request(clientSession, '/ok'); const status = Promise.withResolvers(); ok.onheaders = mustCall((headers) => status.resolve(headers[':status'])); assert.strictEqual(await status.promise, 200, label); diff --git a/test/parallel/test-quic-h3-settings.mjs b/test/parallel/test-quic-h3-settings.mjs index 733d3865e872..fc1438ad166f 100644 --- a/test/parallel/test-quic-h3-settings.mjs +++ b/test/parallel/test-quic-h3-settings.mjs @@ -61,7 +61,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/limited', @@ -120,7 +120,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/length-limited', @@ -177,7 +177,7 @@ const decoder = new TextDecoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/settings', diff --git a/test/parallel/test-quic-h3-status-code-type.mjs b/test/parallel/test-quic-h3-status-code-type.mjs index a1bc7178e17a..c1951b3d8d4b 100644 --- a/test/parallel/test-quic-h3-status-code-type.mjs +++ b/test/parallel/test-quic-h3-status-code-type.mjs @@ -44,7 +44,7 @@ const clientSession = await connect(serverEndpoint.address, { await clientSession.opened; for (const expected of codes) { - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/', diff --git a/test/parallel/test-quic-h3-stream-credit.mjs b/test/parallel/test-quic-h3-stream-credit.mjs index 276a6ede247a..91f922161d78 100644 --- a/test/parallel/test-quic-h3-stream-credit.mjs +++ b/test/parallel/test-quic-h3-stream-credit.mjs @@ -59,7 +59,7 @@ assert.strictEqual(info.protocol, 'h3'); // pending and fire as the max-stream credit is returned. const streams = []; for (let i = 0; i < kRequests; i++) { - streams.push(await clientSession.createBidirectionalStream({ + streams.push(clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': `/${i}`, diff --git a/test/parallel/test-quic-h3-stream-destroy-no-resurrect.mjs b/test/parallel/test-quic-h3-stream-destroy-no-resurrect.mjs index c9e05eb245b1..691b095f7a14 100644 --- a/test/parallel/test-quic-h3-stream-destroy-no-resurrect.mjs +++ b/test/parallel/test-quic-h3-stream-destroy-no-resurrect.mjs @@ -73,7 +73,7 @@ const info = await clientSession.opened; assert.strictEqual(info.protocol, 'h3'); for (let i = 0; i < kRequests; i++) { - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': `/${i}`, diff --git a/test/parallel/test-quic-h3-stream-destroy-with-headers.mjs b/test/parallel/test-quic-h3-stream-destroy-with-headers.mjs index 2f5739185f99..7a573c0e4fe2 100644 --- a/test/parallel/test-quic-h3-stream-destroy-with-headers.mjs +++ b/test/parallel/test-quic-h3-stream-destroy-with-headers.mjs @@ -36,7 +36,7 @@ const clientSession = await connect(serverEndpoint.address, { await clientSession.opened; // Create a stream with headers, then immediately destroy it. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/destroyed', diff --git a/test/parallel/test-quic-h3-stream-idle-timeout.mjs b/test/parallel/test-quic-h3-stream-idle-timeout.mjs index f3e83a8397ca..152b58e7e38b 100644 --- a/test/parallel/test-quic-h3-stream-idle-timeout.mjs +++ b/test/parallel/test-quic-h3-stream-idle-timeout.mjs @@ -56,7 +56,7 @@ const encoder = new TextEncoder(); // Send a POST request with a body byte so the server creates the // stream, then stop sending (don't end the write side). - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'POST', ':path': '/', @@ -109,7 +109,7 @@ const encoder = new TextEncoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ onheaders() {}, }); stream.sendHeaders({ @@ -159,7 +159,7 @@ const encoder = new TextEncoder(); }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ onheaders() {}, }); stream.sendHeaders({ diff --git a/test/parallel/test-quic-h3-stream-without-onstream.mjs b/test/parallel/test-quic-h3-stream-without-onstream.mjs index fcd5bbe019ba..e59190f056c7 100644 --- a/test/parallel/test-quic-h3-stream-without-onstream.mjs +++ b/test/parallel/test-quic-h3-stream-without-onstream.mjs @@ -66,7 +66,7 @@ function failOnConsumerWarning(warning) { await clientSession.opened; const headersReceived = Promise.withResolvers(); - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/test', @@ -122,7 +122,7 @@ function failOnConsumerWarning(warning) { }); await clientSession.opened; - const stream = await clientSession.createUnidirectionalStream(); + const stream = clientSession.createUnidirectionalStream(); stream.writer.writeSync('x'); await warned.promise; @@ -155,7 +155,7 @@ const kNonConsumerCallbacks = ['oninfo', 'ontrailers', 'onwanttrailers']; verifyPeer: 'manual', }); await bootSession.opened; - const probeStream = await bootSession.createBidirectionalStream(); + const probeStream = bootSession.createBidirectionalStream(); probeStream.onerror = () => {}; const candidates = Object.getOwnPropertyNames(Object.getPrototypeOf(probeStream)) .filter((name) => name.startsWith('on')); @@ -182,7 +182,7 @@ const kNonConsumerCallbacks = ['oninfo', 'ontrailers', 'onwanttrailers']; verifyPeer: 'manual', }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/test', @@ -228,7 +228,7 @@ for (const callbackName of kNonConsumerCallbacks) { }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/test', diff --git a/test/parallel/test-quic-h3-trailing-headers.mjs b/test/parallel/test-quic-h3-trailing-headers.mjs index f4ffc223d4d5..24e9d48de57b 100644 --- a/test/parallel/test-quic-h3-trailing-headers.mjs +++ b/test/parallel/test-quic-h3-trailing-headers.mjs @@ -86,7 +86,7 @@ await clientSession.opened; const clientHeadersReceived = Promise.withResolvers(); const clientTrailersReceived = Promise.withResolvers(); -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/with-trailers', diff --git a/test/parallel/test-quic-h3-uni-stream-teardown.mjs b/test/parallel/test-quic-h3-uni-stream-teardown.mjs index 6f93ef73eb2d..797eed21d6c8 100644 --- a/test/parallel/test-quic-h3-uni-stream-teardown.mjs +++ b/test/parallel/test-quic-h3-uni-stream-teardown.mjs @@ -27,7 +27,7 @@ const session = await connect(endpoint.address, { verifyPeer: 'manual', }); -const stream = await session.createUnidirectionalStream(); +const stream = session.createUnidirectionalStream(); stream.writer.writeSync('x'); endpoint.destroy(); diff --git a/test/parallel/test-quic-h3-zero-rtt-rejected-settings.mjs b/test/parallel/test-quic-h3-zero-rtt-rejected-settings.mjs index 755bde188e0b..e31d859d894e 100644 --- a/test/parallel/test-quic-h3-zero-rtt-rejected-settings.mjs +++ b/test/parallel/test-quic-h3-zero-rtt-rejected-settings.mjs @@ -66,7 +66,7 @@ async function getTicket(endpointOptions) { await cs.opened; await Promise.all([gotTicket.promise, gotToken.promise]); - const s = await cs.createBidirectionalStream({ + const s = cs.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/ticket', @@ -111,7 +111,7 @@ async function attemptRejected0RTT(endpointOptions, ticket, token) { // or datagram is sent. When 0-RTT is rejected, the stream is // destroyed by EarlyDataRejected — its closed promise rejects // with an application error. - const s = await cs.createBidirectionalStream({ + const s = cs.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/rejected', diff --git a/test/parallel/test-quic-h3-zero-rtt.mjs b/test/parallel/test-quic-h3-zero-rtt.mjs index f836caa1ec4f..9baacbc61563 100644 --- a/test/parallel/test-quic-h3-zero-rtt.mjs +++ b/test/parallel/test-quic-h3-zero-rtt.mjs @@ -75,7 +75,7 @@ assert.strictEqual(info1.earlyDataAccepted, false); await Promise.all([gotTicket.promise, gotToken.promise]); -const s1 = await cs1.createBidirectionalStream({ +const s1 = cs1.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/first', @@ -103,7 +103,7 @@ const cs2 = await connect(serverEndpoint.address, { }); // Send H3 request BEFORE handshake completes — true 0-RTT. -const s2 = await cs2.createBidirectionalStream({ +const s2 = cs2.createBidirectionalStream({ headers: { ':method': 'GET', ':path': '/early', diff --git a/test/parallel/test-quic-key-update-peer.mjs b/test/parallel/test-quic-key-update-peer.mjs index 4beefcbae69d..6227eddf634e 100644 --- a/test/parallel/test-quic-key-update-peer.mjs +++ b/test/parallel/test-quic-key-update-peer.mjs @@ -39,7 +39,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Send data after the server's key update — should work transparently. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('after key update'), }); await dump(stream); diff --git a/test/parallel/test-quic-key-update.mjs b/test/parallel/test-quic-key-update.mjs index 9ae52a922d51..392755f09566 100644 --- a/test/parallel/test-quic-key-update.mjs +++ b/test/parallel/test-quic-key-update.mjs @@ -40,7 +40,7 @@ await clientSession.opened; clientSession.updateKey(); // Open a stream and send data — should work with new keys. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(data); await dump(stream); diff --git a/test/parallel/test-quic-max-payload-size.mjs b/test/parallel/test-quic-max-payload-size.mjs index fde5e4e12b89..b11f94b8b369 100644 --- a/test/parallel/test-quic-max-payload-size.mjs +++ b/test/parallel/test-quic-max-payload-size.mjs @@ -37,7 +37,7 @@ async function transferAndGetPacketCount(maxPayloadSize) { maxPayloadSize ? { maxPayloadSize } : {}); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(new Uint8Array(dataLength)); await dump(stream); await Promise.all([stream.closed, serverDone.promise]); diff --git a/test/parallel/test-quic-max-window.mjs b/test/parallel/test-quic-max-window.mjs index eb4cc8c359b9..e66ee9f917c4 100644 --- a/test/parallel/test-quic-max-window.mjs +++ b/test/parallel/test-quic-max-window.mjs @@ -40,7 +40,7 @@ const dataLength = 8192; const clientSession = await connect(serverEndpoint.address); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(new Uint8Array(dataLength)); await dump(stream); await Promise.all([stream.closed, serverDone.promise, clientSession.closed]); @@ -68,7 +68,7 @@ const dataLength = 8192; const clientSession = await connect(serverEndpoint.address); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(new Uint8Array(dataLength)); await dump(stream); await Promise.all([stream.closed, serverDone.promise, clientSession.closed]); diff --git a/test/parallel/test-quic-maxstreamdata-external-buffer-failure.mjs b/test/parallel/test-quic-maxstreamdata-external-buffer-failure.mjs index 5126c7bbf4c1..e734bdf174c2 100644 --- a/test/parallel/test-quic-maxstreamdata-external-buffer-failure.mjs +++ b/test/parallel/test-quic-maxstreamdata-external-buffer-failure.mjs @@ -54,7 +54,7 @@ const session = await connect(endpoint.address, { await session.opened; // Budget well above the window, so the window is what stops the writer. -const stream = await session.createBidirectionalStream({ budget: 1024 * 1024 }); +const stream = session.createBidirectionalStream({ budget: 1024 * 1024 }); const writer = stream.writer; writer.writeSync(new Uint8Array(BODY)); diff --git a/test/parallel/test-quic-multipacket-clienthello.mjs b/test/parallel/test-quic-multipacket-clienthello.mjs index 2d701a899fc4..abcb140a4022 100644 --- a/test/parallel/test-quic-multipacket-clienthello.mjs +++ b/test/parallel/test-quic-multipacket-clienthello.mjs @@ -52,7 +52,7 @@ const session = await connect(endpoint.address, { }); await session.opened; -const stream = await session.createBidirectionalStream({ +const stream = session.createBidirectionalStream({ body: 'application event survived', }); await Promise.all([stream.closed, streamReceived.promise]); diff --git a/test/parallel/test-quic-perf-hooks.mjs b/test/parallel/test-quic-perf-hooks.mjs index 256283acef31..295c4836145e 100644 --- a/test/parallel/test-quic-perf-hooks.mjs +++ b/test/parallel/test-quic-perf-hooks.mjs @@ -50,7 +50,7 @@ const serverEndpoint = await listen(mustCall(async (serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('perf test'), }); diff --git a/test/parallel/test-quic-session-application-options.mjs b/test/parallel/test-quic-session-application-options.mjs index a97b654e98b3..37d3f87832b9 100644 --- a/test/parallel/test-quic-session-application-options.mjs +++ b/test/parallel/test-quic-session-application-options.mjs @@ -90,7 +90,7 @@ assert.strictEqual(clientOpts.enableConnectProtocol, assert.strictEqual(clientOpts.enableDatagrams, customAppOptions.enableDatagrams); // Exchange data to let the server side run its assertions. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.writer.endSync(); await dump(stream); diff --git a/test/parallel/test-quic-session-close-graceful.mjs b/test/parallel/test-quic-session-close-graceful.mjs index 41bd7481fe37..a8d76488a2df 100644 --- a/test/parallel/test-quic-session-close-graceful.mjs +++ b/test/parallel/test-quic-session-close-graceful.mjs @@ -38,7 +38,7 @@ const encoder = new TextEncoder(); await clientSession.opened; // Open a stream and send data. - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: encoder.encode('hello'), }); @@ -74,9 +74,9 @@ const encoder = new TextEncoder(); clientSession.close(); - // Attempting to create a stream after close() should reject. - await assert.rejects( - clientSession.createBidirectionalStream({ + // Attempting to create a stream after close() should throw. + assert.throws( + () => clientSession.createBidirectionalStream({ body: encoder.encode('too late'), }), { diff --git a/test/parallel/test-quic-session-destroy-reentrant.mjs b/test/parallel/test-quic-session-destroy-reentrant.mjs index e429987aab5b..ab948fd69913 100644 --- a/test/parallel/test-quic-session-destroy-reentrant.mjs +++ b/test/parallel/test-quic-session-destroy-reentrant.mjs @@ -118,7 +118,7 @@ const transportParams = { maxIdleTimeout: 1 }; }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const testError = new Error('cascade reentrant destroy test'); @@ -160,7 +160,7 @@ const transportParams = { maxIdleTimeout: 1 }; }); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const testError = new Error('stream reentrant destroy test'); diff --git a/test/parallel/test-quic-session-destroy-validate-options.mjs b/test/parallel/test-quic-session-destroy-validate-options.mjs index a57b718f812c..6d2d6b5b1eac 100644 --- a/test/parallel/test-quic-session-destroy-validate-options.mjs +++ b/test/parallel/test-quic-session-destroy-validate-options.mjs @@ -54,7 +54,7 @@ await serverSessionReady.promise; // validation hoist regresses and side effects run before the throw, // this stream will be destroyed by the failed destroy() and the // `mustNotCall` handler will fire. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.onerror = mustNotCall( 'stream.onerror must not fire when destroy() throws on bad options'); diff --git a/test/parallel/test-quic-session-initial-rtt.mjs b/test/parallel/test-quic-session-initial-rtt.mjs index ba40e351c69b..62ba7373f6ff 100644 --- a/test/parallel/test-quic-session-initial-rtt.mjs +++ b/test/parallel/test-quic-session-initial-rtt.mjs @@ -39,7 +39,7 @@ const clientSession = await connect(serverEndpoint.address, { }); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: payload, }); diff --git a/test/parallel/test-quic-session-stats-detailed.mjs b/test/parallel/test-quic-session-stats-detailed.mjs index 8ce2e83ed6b3..83b52373f95b 100644 --- a/test/parallel/test-quic-session-stats-detailed.mjs +++ b/test/parallel/test-quic-session-stats-detailed.mjs @@ -33,7 +33,7 @@ await clientSession.opened; // Send enough data to generate meaningful stats. const data = new Uint8Array(8192); -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(data); await dump(stream); diff --git a/test/parallel/test-quic-session-stats.mjs b/test/parallel/test-quic-session-stats.mjs index 26dcf272a867..9b3e878f50bf 100644 --- a/test/parallel/test-quic-session-stats.mjs +++ b/test/parallel/test-quic-session-stats.mjs @@ -47,7 +47,7 @@ await clientSession.opened; const bytesSentBefore = clientSession.stats.bytesSent; assert.ok(bytesSentBefore > 0n, 'handshake bytes should be counted'); -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: payload, }); diff --git a/test/parallel/test-quic-session-stream-lifecycle.mjs b/test/parallel/test-quic-session-stream-lifecycle.mjs index 3c24810bd9a6..9aacd472b704 100644 --- a/test/parallel/test-quic-session-stream-lifecycle.mjs +++ b/test/parallel/test-quic-session-stream-lifecycle.mjs @@ -72,7 +72,7 @@ assert.ok(cStats.bytesSent > 0n, 'Expected bytesSent > 0 after handshake'); await serverDone.promise; // Open a bidirectional stream. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); assert.strictEqual(stream.destroyed, false); assert.strictEqual(stream.direction, 'bidi'); diff --git a/test/parallel/test-quic-session-transport-params.mjs b/test/parallel/test-quic-session-transport-params.mjs index c2417bb999ed..ff8380efe4fe 100644 --- a/test/parallel/test-quic-session-transport-params.mjs +++ b/test/parallel/test-quic-session-transport-params.mjs @@ -116,7 +116,7 @@ assert.ok(clientRemoteParams.initialSCID.length > 0, 'remote initialSCID should be non-empty'); // Cross-validation: server's remote matches client's local and vice versa. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.writer.endSync(); await dump(stream); diff --git a/test/parallel/test-quic-shared-endpoint-stream-close.mjs b/test/parallel/test-quic-shared-endpoint-stream-close.mjs index ac070b49fc0a..ec9a451947f5 100644 --- a/test/parallel/test-quic-shared-endpoint-stream-close.mjs +++ b/test/parallel/test-quic-shared-endpoint-stream-close.mjs @@ -57,7 +57,7 @@ const client1 = await connect(serverEndpoint.address, { }); await client1.opened; -const s1 = await client1.createBidirectionalStream({ +const s1 = client1.createBidirectionalStream({ body: encoder.encode('session1'), }); await dump(s1); @@ -67,7 +67,7 @@ await serverDone1.promise; // Trigger the stateless reset. // eslint-disable-next-line no-unused-vars -const s1b = await client1.createBidirectionalStream({ +const s1b = client1.createBidirectionalStream({ body: encoder.encode('trigger'), }); await assert.rejects(client1.closed, { code: 'ERR_QUIC_TRANSPORT_ERROR' }); @@ -82,7 +82,7 @@ const client2 = await connect(serverEndpoint.address, { }); await client2.opened; -const s2 = await client2.createBidirectionalStream({ +const s2 = client2.createBidirectionalStream({ body: encoder.encode('session2'), }); await dump(s2); diff --git a/test/parallel/test-quic-stateless-reset.mjs b/test/parallel/test-quic-stateless-reset.mjs index 5b20e9453f9b..be8365c96b82 100644 --- a/test/parallel/test-quic-stateless-reset.mjs +++ b/test/parallel/test-quic-stateless-reset.mjs @@ -52,7 +52,7 @@ const encoder = new TextEncoder(); await clientSession.opened; // First exchange: complete round-trip to confirm 1-RTT. - const stream1 = await clientSession.createBidirectionalStream({ + const stream1 = clientSession.createBidirectionalStream({ body: encoder.encode('hello'), }); await dump(stream1); @@ -65,7 +65,7 @@ const encoder = new TextEncoder(); // to the server. The server endpoint doesn't recognize the DCID // and should send a stateless reset. // eslint-disable-next-line no-unused-vars - const stream2 = await clientSession.createBidirectionalStream({ + const stream2 = clientSession.createBidirectionalStream({ body: encoder.encode('after destroy'), }); @@ -111,7 +111,7 @@ const encoder = new TextEncoder(); }); await clientSession.opened; - const stream1 = await clientSession.createBidirectionalStream({ + const stream1 = clientSession.createBidirectionalStream({ body: encoder.encode('hello'), }); await dump(stream1); @@ -122,7 +122,7 @@ const encoder = new TextEncoder(); // Send a packet after the server session is destroyed. The server // endpoint silently drops the packet (stateless reset disabled). // eslint-disable-next-line no-unused-vars - const stream2 = await clientSession.createBidirectionalStream({ + const stream2 = clientSession.createBidirectionalStream({ body: encoder.encode('after destroy'), }); @@ -176,14 +176,14 @@ const encoder = new TextEncoder(); await client1.opened; // Send data so the server onstream fires and destroys the session. - await client1.createBidirectionalStream({ + client1.createBidirectionalStream({ body: encoder.encode('session1'), }); await serverDestroyed1.promise; // Send a packet to trigger stateless reset. // eslint-disable-next-line no-unused-vars - const s1b = await client1.createBidirectionalStream({ + const s1b = client1.createBidirectionalStream({ body: encoder.encode('after destroy 1'), }); await assert.rejects(client1.closed, { code: 'ERR_QUIC_TRANSPORT_ERROR' }); @@ -204,7 +204,7 @@ const encoder = new TextEncoder(); await client2.opened; // Send data so the server onstream fires and destroys the session. - await client2.createBidirectionalStream({ + client2.createBidirectionalStream({ body: encoder.encode('session2'), }); await serverDestroyed2.promise; @@ -212,7 +212,7 @@ const encoder = new TextEncoder(); // Send a packet — the server would normally send a stateless reset, // but the global rate limit (burst of 1) is already exhausted. // eslint-disable-next-line no-unused-vars - const s2b = await client2.createBidirectionalStream({ + const s2b = client2.createBidirectionalStream({ body: encoder.encode('after destroy 2'), }); diff --git a/test/parallel/test-quic-stats-tojson-inspect.mjs b/test/parallel/test-quic-stats-tojson-inspect.mjs index 560acda49172..bffafa4bd0ac 100644 --- a/test/parallel/test-quic-stats-tojson-inspect.mjs +++ b/test/parallel/test-quic-stats-tojson-inspect.mjs @@ -54,7 +54,7 @@ assert.strictEqual(typeof clientStatsJson.createdAt, 'string'); const clientStatsInspect = inspect(clientSession.stats); assert.ok(clientStatsInspect.includes('QuicSessionStats')); -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: new TextEncoder().encode('test'), }); for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars diff --git a/test/parallel/test-quic-stream-bidi-basic.mjs b/test/parallel/test-quic-stream-bidi-basic.mjs index adbbca33c5e4..9803f1eaa783 100644 --- a/test/parallel/test-quic-stream-bidi-basic.mjs +++ b/test/parallel/test-quic-stream-bidi-basic.mjs @@ -49,7 +49,7 @@ await clientSession.opened; // Create a bidi stream with the message as the body. // For DefaultApplication, the server's onstream fires when data arrives. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: body, }); diff --git a/test/parallel/test-quic-stream-bidi-concurrent.mjs b/test/parallel/test-quic-stream-bidi-concurrent.mjs index 4428749f578b..4311f614d79e 100644 --- a/test/parallel/test-quic-stream-bidi-concurrent.mjs +++ b/test/parallel/test-quic-stream-bidi-concurrent.mjs @@ -50,12 +50,10 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Open all streams concurrently. -const clientStreams = await Promise.all( - messages.map((msg) => - clientSession.createBidirectionalStream({ - body: encoder.encode(msg), - }), - ), +const clientStreams = messages.map((msg) => + clientSession.createBidirectionalStream({ + body: encoder.encode(msg), + }), ); await Promise.all([done.promise, ...clientStreams.map((s) => s.closed)]); diff --git a/test/parallel/test-quic-stream-bidi-echo.mjs b/test/parallel/test-quic-stream-bidi-echo.mjs index 7f556f0295c0..d58595bd79cc 100644 --- a/test/parallel/test-quic-stream-bidi-echo.mjs +++ b/test/parallel/test-quic-stream-bidi-echo.mjs @@ -41,7 +41,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; const body = encoder.encode(message); -const stream = await clientSession.createBidirectionalStream({ body }); +const stream = clientSession.createBidirectionalStream({ body }); // Read the echoed response from the server. const echoed = await bytes(stream); diff --git a/test/parallel/test-quic-stream-bidi-halfclose.mjs b/test/parallel/test-quic-stream-bidi-halfclose.mjs index 42c711ee2050..c391985ad7ff 100644 --- a/test/parallel/test-quic-stream-bidi-halfclose.mjs +++ b/test/parallel/test-quic-stream-bidi-halfclose.mjs @@ -44,7 +44,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Create a stream with a body -- this sends FIN after the body. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode(clientMessage), }); diff --git a/test/parallel/test-quic-stream-bidi-large.mjs b/test/parallel/test-quic-stream-bidi-large.mjs index 32c9c46572ec..5973bae183fa 100644 --- a/test/parallel/test-quic-stream-bidi-large.mjs +++ b/test/parallel/test-quic-stream-bidi-large.mjs @@ -65,7 +65,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); const w = stream.writer; // Write chunks, respecting backpressure via drainableProtocol. diff --git a/test/parallel/test-quic-stream-bidi-server-initiated.mjs b/test/parallel/test-quic-stream-bidi-server-initiated.mjs index f5cabd3e737b..e33f7239be5e 100644 --- a/test/parallel/test-quic-stream-bidi-server-initiated.mjs +++ b/test/parallel/test-quic-stream-bidi-server-initiated.mjs @@ -26,7 +26,7 @@ const done = Promise.withResolvers(); const serverEndpoint = await listen(mustCall(async (serverSession) => { await serverSession.opened; - const stream = await serverSession.createBidirectionalStream({ + const stream = serverSession.createBidirectionalStream({ body: encoder.encode(message), }); diff --git a/test/parallel/test-quic-stream-bidi-setbody.mjs b/test/parallel/test-quic-stream-bidi-setbody.mjs index 84858f594a29..c887058c7d28 100644 --- a/test/parallel/test-quic-stream-bidi-setbody.mjs +++ b/test/parallel/test-quic-stream-bidi-setbody.mjs @@ -40,7 +40,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Create a stream with no body. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); // Attach a body after creation. stream.setBody(encoder.encode(message)); diff --git a/test/parallel/test-quic-stream-bidi-varchunklen.mjs b/test/parallel/test-quic-stream-bidi-varchunklen.mjs index d39a53b5edb2..4db6e87456fd 100644 --- a/test/parallel/test-quic-stream-bidi-varchunklen.mjs +++ b/test/parallel/test-quic-stream-bidi-varchunklen.mjs @@ -68,7 +68,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); const w = stream.writer; // Write chunks, respecting backpressure via drainableProtocol. diff --git a/test/parallel/test-quic-stream-bidi-writer.mjs b/test/parallel/test-quic-stream-bidi-writer.mjs index 7177a8c7f44f..080533880d1d 100644 --- a/test/parallel/test-quic-stream-bidi-writer.mjs +++ b/test/parallel/test-quic-stream-bidi-writer.mjs @@ -35,7 +35,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); const w = stream.writer; // Writer should be open. diff --git a/test/parallel/test-quic-stream-body-async-error.mjs b/test/parallel/test-quic-stream-body-async-error.mjs index c9c81d2dbcb2..5b2307546bce 100644 --- a/test/parallel/test-quic-stream-body-async-error.mjs +++ b/test/parallel/test-quic-stream-body-async-error.mjs @@ -31,7 +31,7 @@ async function* failingSource() { throw testError; } -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); // Attach the closed handler BEFORE setBody so the rejection from // stream.destroy(err) is caught before it becomes unhandled. diff --git a/test/parallel/test-quic-stream-body-async-iterable.mjs b/test/parallel/test-quic-stream-body-async-iterable.mjs index 02689c0dee7d..3d8dcafb0adf 100644 --- a/test/parallel/test-quic-stream-body-async-iterable.mjs +++ b/test/parallel/test-quic-stream-body-async-iterable.mjs @@ -41,7 +41,7 @@ async function* generateChunks() { } } -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(generateChunks()); await dump(stream); diff --git a/test/parallel/test-quic-stream-body-error.mjs b/test/parallel/test-quic-stream-body-error.mjs index 5b3690440262..d102eb2943fc 100644 --- a/test/parallel/test-quic-stream-body-error.mjs +++ b/test/parallel/test-quic-stream-body-error.mjs @@ -33,7 +33,7 @@ async function* slowSource() { } } -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(slowSource()); // Destroy the stream after a short delay. diff --git a/test/parallel/test-quic-stream-body-filehandle.mjs b/test/parallel/test-quic-stream-body-filehandle.mjs index 5e1bc3d64730..312699e4e2cb 100644 --- a/test/parallel/test-quic-stream-body-filehandle.mjs +++ b/test/parallel/test-quic-stream-body-filehandle.mjs @@ -45,7 +45,7 @@ writeFileSync(testFile, testContent); await clientSession.opened; const fh = await open(testFile, 'r'); - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: fh, }); @@ -76,7 +76,7 @@ writeFileSync(testFile, testContent); await clientSession.opened; const fh = await open(testFile, 'r'); - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(fh); const response = await bytes(stream); @@ -104,13 +104,13 @@ writeFileSync(testFile, testContent); const fh = await open(testFile, 'r'); // First use locks the FileHandle. - const stream1 = await clientSession.createBidirectionalStream({ + const stream1 = clientSession.createBidirectionalStream({ body: fh, }); - // Second use should reject because it's locked. - await assert.rejects( - clientSession.createBidirectionalStream({ body: fh }), + // Second use should throw because it's locked. + assert.throws( + () => clientSession.createBidirectionalStream({ body: fh }), { code: 'ERR_INVALID_STATE' }, ); diff --git a/test/parallel/test-quic-stream-body-pooled-buffer.mjs b/test/parallel/test-quic-stream-body-pooled-buffer.mjs index 0d1ebc0d8919..289fad31eb37 100644 --- a/test/parallel/test-quic-stream-body-pooled-buffer.mjs +++ b/test/parallel/test-quic-stream-body-pooled-buffer.mjs @@ -41,7 +41,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Send the pooled buffer as body via setBody. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(expected); await dump(stream); diff --git a/test/parallel/test-quic-stream-body-promise-error.mjs b/test/parallel/test-quic-stream-body-promise-error.mjs index 8166bf4144cc..c4a105719c6c 100644 --- a/test/parallel/test-quic-stream-body-promise-error.mjs +++ b/test/parallel/test-quic-stream-body-promise-error.mjs @@ -23,7 +23,7 @@ const clientSession = await connect(serverEndpoint.address, { await clientSession.opened; const testError = new Error('promise body rejected'); -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); // Attach the closed handler BEFORE setBody so the rejection from // stream.destroy(err) is caught before it becomes unhandled. diff --git a/test/parallel/test-quic-stream-body-promise-invalid.mjs b/test/parallel/test-quic-stream-body-promise-invalid.mjs index 65f4dd27bb32..87041e0f7f6b 100644 --- a/test/parallel/test-quic-stream-body-promise-invalid.mjs +++ b/test/parallel/test-quic-stream-body-promise-invalid.mjs @@ -23,11 +23,11 @@ const clientSession = await connect(serverEndpoint.address, { }); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); assert.throws(() => stream.setBody(42), { code: 'ERR_INVALID_ARG_TYPE' }); -const stream2 = await clientSession.createBidirectionalStream(); +const stream2 = clientSession.createBidirectionalStream(); const closedPromise = assert.rejects(stream2.closed, { code: 'ERR_INVALID_ARG_TYPE', diff --git a/test/parallel/test-quic-stream-body-promise-reject.mjs b/test/parallel/test-quic-stream-body-promise-reject.mjs index 24cbeb46e2c9..02d5e3b75116 100644 --- a/test/parallel/test-quic-stream-body-promise-reject.mjs +++ b/test/parallel/test-quic-stream-body-promise-reject.mjs @@ -38,7 +38,7 @@ const { bytes } = await import('stream/iter'); await clientSession.opened; // Double-nested promise: Promise> - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody( Promise.resolve(Promise.resolve('nested promise')), ); diff --git a/test/parallel/test-quic-stream-body-promise.mjs b/test/parallel/test-quic-stream-body-promise.mjs index f73896b2a954..b59a771743ca 100644 --- a/test/parallel/test-quic-stream-body-promise.mjs +++ b/test/parallel/test-quic-stream-body-promise.mjs @@ -51,7 +51,7 @@ await clientSession.opened; // Promise { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(Promise.resolve('resolved string')); await dump(stream); await stream.closed; @@ -59,7 +59,7 @@ await clientSession.opened; // Promise { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(Promise.resolve(null)); await dump(stream); await stream.closed; diff --git a/test/parallel/test-quic-stream-body-readable-stream.mjs b/test/parallel/test-quic-stream-body-readable-stream.mjs index ca98f038edef..367425fc83f1 100644 --- a/test/parallel/test-quic-stream-body-readable-stream.mjs +++ b/test/parallel/test-quic-stream-body-readable-stream.mjs @@ -45,7 +45,7 @@ await clientSession.opened; controller.close(); }, }); - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(rs); await dump(stream); await stream.closed; @@ -54,7 +54,7 @@ await clientSession.opened; // Node.js stream.Readable as body source. { const readable = Readable.from([encoder.encode(message)]); - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(readable); await dump(stream); await stream.closed; diff --git a/test/parallel/test-quic-stream-body-sources.mjs b/test/parallel/test-quic-stream-body-sources.mjs index 93218b697f86..ae77e0e6db95 100644 --- a/test/parallel/test-quic-stream-body-sources.mjs +++ b/test/parallel/test-quic-stream-body-sources.mjs @@ -45,7 +45,7 @@ await clientSession.opened; { const buf = encoder.encode(message); const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - const stream = await clientSession.createBidirectionalStream({ body: ab }); + const stream = clientSession.createBidirectionalStream({ body: ab }); await dump(stream); await stream.closed; } @@ -57,7 +57,7 @@ await clientSession.opened; const offset = 10; fullView.set(expectedBytes, offset); const view = new Uint8Array(backing, offset, expectedBytes.byteLength); - const stream = await clientSession.createBidirectionalStream({ body: view }); + const stream = clientSession.createBidirectionalStream({ body: view }); await dump(stream); await stream.closed; } @@ -67,7 +67,7 @@ await clientSession.opened; const sab = new SharedArrayBuffer(expectedBytes.byteLength); const sabView = new Uint8Array(sab); sabView.set(expectedBytes); - const stream = await clientSession.createBidirectionalStream({ body: sabView }); + const stream = clientSession.createBidirectionalStream({ body: sabView }); // The SharedArrayBuffer should still be usable (copied, not transferred). assert.strictEqual(sab.byteLength, expectedBytes.byteLength); await dump(stream); @@ -77,7 +77,7 @@ await clientSession.opened; // Test 4: Blob body { const blob = new Blob([expectedBytes]); - const stream = await clientSession.createBidirectionalStream({ body: blob }); + const stream = clientSession.createBidirectionalStream({ body: blob }); await dump(stream); await stream.closed; } diff --git a/test/parallel/test-quic-stream-body-state.mjs b/test/parallel/test-quic-stream-body-state.mjs index 1b3e896f5377..88769efdda3c 100644 --- a/test/parallel/test-quic-stream-body-state.mjs +++ b/test/parallel/test-quic-stream-body-state.mjs @@ -40,7 +40,7 @@ await clientSession.opened; // setBody() after writer accessed throws. { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); // Access the writer — this initializes the streaming source. const w = stream.writer; assert.ok(w); @@ -55,7 +55,7 @@ await clientSession.opened; // Writer after setBody() throws. { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(encoder.encode('body set')); assert.throws(() => { stream.writer; // eslint-disable-line no-unused-expressions @@ -67,7 +67,7 @@ await clientSession.opened; // setBody() on destroyed stream throws. { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.destroy(); assert.throws(() => { stream.setBody(encoder.encode('destroyed')); diff --git a/test/parallel/test-quic-stream-body-string-shorthand.mjs b/test/parallel/test-quic-stream-body-string-shorthand.mjs index e21fd842f814..f81632f97714 100644 --- a/test/parallel/test-quic-stream-body-string-shorthand.mjs +++ b/test/parallel/test-quic-stream-body-string-shorthand.mjs @@ -35,7 +35,7 @@ const decoder = new TextDecoder(); await clientSession.opened; // Body provided as a string — should be UTF-8 encoded automatically. - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: 'hello from string body', }); @@ -64,7 +64,7 @@ const decoder = new TextDecoder(); const clientSession = await connect(serverEndpoint.address); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody('setBody string'); const response = await bytes(stream); @@ -93,7 +93,7 @@ const decoder = new TextDecoder(); const clientSession = await connect(serverEndpoint.address); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: testString, }); diff --git a/test/parallel/test-quic-stream-body-string.mjs b/test/parallel/test-quic-stream-body-string.mjs index 8a9d76aa3e8a..f261dfe5496b 100644 --- a/test/parallel/test-quic-stream-body-string.mjs +++ b/test/parallel/test-quic-stream-body-string.mjs @@ -33,7 +33,7 @@ await clientSession.opened; // setBody with a string — configureOutbound handles this via // Buffer.from(body, 'utf8'). -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(message); await dump(stream); diff --git a/test/parallel/test-quic-stream-body-sync-iterable.mjs b/test/parallel/test-quic-stream-body-sync-iterable.mjs index d887a5d46860..2546f8706416 100644 --- a/test/parallel/test-quic-stream-body-sync-iterable.mjs +++ b/test/parallel/test-quic-stream-body-sync-iterable.mjs @@ -35,7 +35,7 @@ await clientSession.opened; // Create an array of Uint8Arrays as a sync iterable body. const bodyChunks = chunks.map((c) => encoder.encode(c)); -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(bodyChunks); await dump(stream); diff --git a/test/parallel/test-quic-stream-closed-promise.mjs b/test/parallel/test-quic-stream-closed-promise.mjs index a18aa7f3dd4c..be82e5a7ccb3 100644 --- a/test/parallel/test-quic-stream-closed-promise.mjs +++ b/test/parallel/test-quic-stream-closed-promise.mjs @@ -29,7 +29,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('normal close'), }); diff --git a/test/parallel/test-quic-stream-closed-rejects.mjs b/test/parallel/test-quic-stream-closed-rejects.mjs index aa22a8337bfb..53baee9a1b47 100644 --- a/test/parallel/test-quic-stream-closed-rejects.mjs +++ b/test/parallel/test-quic-stream-closed-rejects.mjs @@ -37,7 +37,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('will error'), }); diff --git a/test/parallel/test-quic-stream-destroy-emits-reset.mjs b/test/parallel/test-quic-stream-destroy-emits-reset.mjs index a8e2bd9051aa..8be241261878 100644 --- a/test/parallel/test-quic-stream-destroy-emits-reset.mjs +++ b/test/parallel/test-quic-stream-destroy-emits-reset.mjs @@ -50,7 +50,7 @@ await clientSession.opened; // streaming source. Pre-B13, calling destroy() on this stream would // not emit RESET_STREAM because the writer.fail path was the only // emission site. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: 'hello world', }); diff --git a/test/parallel/test-quic-stream-destroy-emits-stop-sending.mjs b/test/parallel/test-quic-stream-destroy-emits-stop-sending.mjs index f50d3aac1f72..65015787c72a 100644 --- a/test/parallel/test-quic-stream-destroy-emits-stop-sending.mjs +++ b/test/parallel/test-quic-stream-destroy-emits-stop-sending.mjs @@ -46,7 +46,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: 'client-data', }); diff --git a/test/parallel/test-quic-stream-destroy-no-resurrect.mjs b/test/parallel/test-quic-stream-destroy-no-resurrect.mjs index 50687472a64c..81c49ee128a8 100644 --- a/test/parallel/test-quic-stream-destroy-no-resurrect.mjs +++ b/test/parallel/test-quic-stream-destroy-no-resurrect.mjs @@ -60,7 +60,7 @@ clientSession.onstream = mustNotCall( await clientSession.opened; for (let i = 0; i < kStreams; i++) { - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: new Uint8Array(8), }); diff --git a/test/parallel/test-quic-stream-destroy-options-code.mjs b/test/parallel/test-quic-stream-destroy-options-code.mjs index d211d83b94e2..f2457104e0bb 100644 --- a/test/parallel/test-quic-stream-destroy-options-code.mjs +++ b/test/parallel/test-quic-stream-destroy-options-code.mjs @@ -40,7 +40,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: 'data', }); diff --git a/test/parallel/test-quic-stream-destroy-options-validate.mjs b/test/parallel/test-quic-stream-destroy-options-validate.mjs index ee9b3d1764af..27a576e26ed4 100644 --- a/test/parallel/test-quic-stream-destroy-options-validate.mjs +++ b/test/parallel/test-quic-stream-destroy-options-validate.mjs @@ -21,7 +21,7 @@ const serverEndpoint = await listen(mustCall(() => true)); const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.onerror = mustNotCall( 'stream.onerror must not fire when destroy() throws on bad options'); diff --git a/test/parallel/test-quic-stream-error-code-validation.mjs b/test/parallel/test-quic-stream-error-code-validation.mjs index 4af0bff0c24c..18db5fa32b3d 100644 --- a/test/parallel/test-quic-stream-error-code-validation.mjs +++ b/test/parallel/test-quic-stream-error-code-validation.mjs @@ -13,7 +13,7 @@ const serverEndpoint = await listen(mustCall(() => true)); const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); const invalidTypes = ['1', true, null]; const invalidCodes = [ diff --git a/test/parallel/test-quic-stream-error-graceful-close.mjs b/test/parallel/test-quic-stream-error-graceful-close.mjs index a4dbfc117ff0..8538a65fbcb2 100644 --- a/test/parallel/test-quic-stream-error-graceful-close.mjs +++ b/test/parallel/test-quic-stream-error-graceful-close.mjs @@ -37,7 +37,7 @@ const clientSession = await connect(serverEndpoint.address, { await clientSession.opened; // Send data on a stream. The server will reset it. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(new Uint8Array(4096)); // The stream will error due to the server's reset. diff --git a/test/parallel/test-quic-stream-fin-packet-full.mjs b/test/parallel/test-quic-stream-fin-packet-full.mjs index 2c0749fd3dc5..2c5d22ea3165 100644 --- a/test/parallel/test-quic-stream-fin-packet-full.mjs +++ b/test/parallel/test-quic-stream-fin-packet-full.mjs @@ -41,7 +41,7 @@ await clientSession.opened; const closed = clientSession.closed.then(() => 'closed', () => 'closed'); for (let size = kMinSize; size <= kMaxSize; size++) { - const stream = await clientSession.createUnidirectionalStream(); + const stream = clientSession.createUnidirectionalStream(); stream.setBody(new Uint8Array(size)); const result = await Promise.race([next.promise.then(() => 'ok'), closed]); assert.strictEqual(result, 'ok', diff --git a/test/parallel/test-quic-stream-id-ordering.mjs b/test/parallel/test-quic-stream-id-ordering.mjs index e1a8c939f9ae..3bd02918e608 100644 --- a/test/parallel/test-quic-stream-id-ordering.mjs +++ b/test/parallel/test-quic-stream-id-ordering.mjs @@ -32,7 +32,7 @@ await clientSession.opened; const ids = []; for (let i = 0; i < 10; i++) { - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: encoder.encode(`stream ${i}`), }); ids.push(stream.id); diff --git a/test/parallel/test-quic-stream-idle-timeout.mjs b/test/parallel/test-quic-stream-idle-timeout.mjs index 52a49ee58061..71aa9e8bfc38 100644 --- a/test/parallel/test-quic-stream-idle-timeout.mjs +++ b/test/parallel/test-quic-stream-idle-timeout.mjs @@ -42,7 +42,7 @@ const { listen, connect } = await import('../common/quic.mjs'); // Open a stream and send one byte so the server creates the // peer-initiated stream, then stop sending. - const clientStream = await clientSession.createUnidirectionalStream(); + const clientStream = clientSession.createUnidirectionalStream(); const writer = clientStream.writer; writer.writeSync('x'); @@ -83,7 +83,7 @@ const { listen, connect } = await import('../common/quic.mjs'); await clientSession.opened; // Open a stream and send data immediately. - const clientStrema = await clientSession.createUnidirectionalStream(); + const clientStrema = clientSession.createUnidirectionalStream(); const writer = clientStrema.writer; writer.writeSync(encoder.encode('x')); @@ -123,7 +123,7 @@ const { listen, connect } = await import('../common/quic.mjs'); await clientSession.opened; // Send one byte so the server creates the stream, then stop. - const clientStream = await clientSession.createUnidirectionalStream(); + const clientStream = clientSession.createUnidirectionalStream(); const writer = clientStream.writer; writer.writeSync('x'); diff --git a/test/parallel/test-quic-stream-iteration-batching.mjs b/test/parallel/test-quic-stream-iteration-batching.mjs index 6d7623e5a082..acd587ad1293 100644 --- a/test/parallel/test-quic-stream-iteration-batching.mjs +++ b/test/parallel/test-quic-stream-iteration-batching.mjs @@ -36,7 +36,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('request'), }); diff --git a/test/parallel/test-quic-stream-iteration-break.mjs b/test/parallel/test-quic-stream-iteration-break.mjs index 1c879eca7623..f743cf8bdf14 100644 --- a/test/parallel/test-quic-stream-iteration-break.mjs +++ b/test/parallel/test-quic-stream-iteration-break.mjs @@ -35,7 +35,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('request'), }); diff --git a/test/parallel/test-quic-stream-iteration-double.mjs b/test/parallel/test-quic-stream-iteration-double.mjs index 84bfbb9b3873..35afb69055cd 100644 --- a/test/parallel/test-quic-stream-iteration-double.mjs +++ b/test/parallel/test-quic-stream-iteration-double.mjs @@ -50,7 +50,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('double iter test'), }); await dump(stream); diff --git a/test/parallel/test-quic-stream-iteration-nonreadable.mjs b/test/parallel/test-quic-stream-iteration-nonreadable.mjs index f7de503b9807..474d034af408 100644 --- a/test/parallel/test-quic-stream-iteration-nonreadable.mjs +++ b/test/parallel/test-quic-stream-iteration-nonreadable.mjs @@ -30,7 +30,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createUnidirectionalStream({ +const stream = clientSession.createUnidirectionalStream({ body: encoder.encode('uni data'), }); diff --git a/test/parallel/test-quic-stream-iteration-pipeto.mjs b/test/parallel/test-quic-stream-iteration-pipeto.mjs index a169f2d3af4b..00d46e32fc7c 100644 --- a/test/parallel/test-quic-stream-iteration-pipeto.mjs +++ b/test/parallel/test-quic-stream-iteration-pipeto.mjs @@ -35,7 +35,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode(message), }); diff --git a/test/parallel/test-quic-stream-iteration-pull.mjs b/test/parallel/test-quic-stream-iteration-pull.mjs index 3c296e0d86ee..885e73eeeddf 100644 --- a/test/parallel/test-quic-stream-iteration-pull.mjs +++ b/test/parallel/test-quic-stream-iteration-pull.mjs @@ -41,7 +41,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode(message), }); diff --git a/test/parallel/test-quic-stream-iteration.mjs b/test/parallel/test-quic-stream-iteration.mjs index ef35c87f1298..864b205d2d92 100644 --- a/test/parallel/test-quic-stream-iteration.mjs +++ b/test/parallel/test-quic-stream-iteration.mjs @@ -68,7 +68,7 @@ await clientSession.opened; // Send three streams sequentially. for (let i = 0; i < totalStreams; i++) { - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: encoder.encode(message), }); await dump(stream); diff --git a/test/parallel/test-quic-stream-limits-pending.mjs b/test/parallel/test-quic-stream-limits-pending.mjs index f4498a3acd07..bc81f9b6650a 100644 --- a/test/parallel/test-quic-stream-limits-pending.mjs +++ b/test/parallel/test-quic-stream-limits-pending.mjs @@ -50,7 +50,7 @@ await clientSession.opened; let opened = 0; // First stream opens immediately (within the limit). -const s1 = await clientSession.createBidirectionalStream({ +const s1 = clientSession.createBidirectionalStream({ body: encoder.encode('stream 1'), }); @@ -59,26 +59,19 @@ s1.opened.then(() => { opened++; }); -let s2; -await assert.rejects( - async () => { - // Second stream should not open, but throw. - s2 = await clientSession.createBidirectionalStream({ - body: encoder.encode('stream 2a'), - waitUntilAvailable: false, - }); - // eslint-disable-next-line node-core/must-call-assert - s2.opened.then(() => { - opened++; - }); - }, +// Second stream should not open, but throw. +assert.throws( + () => clientSession.createBidirectionalStream({ + body: encoder.encode('stream 2a'), + waitUntilAvailable: false, + }), { name: 'Error', message: 'No new stream available within flow control', }, ); // Ok try again a second second stream, that patiently waits -s2 = await clientSession.createBidirectionalStream({ +const s2 = clientSession.createBidirectionalStream({ body: encoder.encode('stream 2b') }); // eslint-disable-next-line node-core/must-call-assert @@ -89,7 +82,7 @@ s2.opened.then(() => { // Third stream is created but queued as pending because the // server only allows 1 concurrent bidi stream. -const s3 = await clientSession.createBidirectionalStream({ +const s3 = clientSession.createBidirectionalStream({ body: encoder.encode('stream 3'), }); @@ -98,6 +91,8 @@ const s3 = await clientSession.createBidirectionalStream({ // more stream credits. assert.strictEqual(s2.pending, true); assert.strictEqual(s3.pending, true); + +await s1.opened; assert.strictEqual(opened, 1); await dump(s1); @@ -117,7 +112,7 @@ await s2.closed; await sleep(10); // We wait a bit, as we do not have a callback exposed to js // fourth stream should open immediately and not throw -const s4 = await clientSession.createBidirectionalStream({ +const s4 = clientSession.createBidirectionalStream({ body: encoder.encode('stream 4'), waitUntilAvailable: false }); diff --git a/test/parallel/test-quic-stream-limits-uni.mjs b/test/parallel/test-quic-stream-limits-uni.mjs index 1c7fbd974386..7bec4b5a6e7b 100644 --- a/test/parallel/test-quic-stream-limits-uni.mjs +++ b/test/parallel/test-quic-stream-limits-uni.mjs @@ -37,7 +37,7 @@ await clientSession.opened; let opened = 0; // First uni stream opens immediately. -const s1 = await clientSession.createUnidirectionalStream({ +const s1 = clientSession.createUnidirectionalStream({ body: encoder.encode('uni 1'), waitUntilAvailable: false, }); @@ -48,7 +48,7 @@ s1.opened.then(() => { }); // Second uni stream is pending (limit = 1). -const s2 = await clientSession.createUnidirectionalStream({ +const s2 = clientSession.createUnidirectionalStream({ body: encoder.encode('uni 2'), }); @@ -56,10 +56,11 @@ const s2 = await clientSession.createUnidirectionalStream({ s2.opened.then(() => { opened++; }); -assert.strictEqual(opened, 1); - assert.strictEqual(s2.pending, true); +await s1.opened; +assert.strictEqual(opened, 1); + // Wait for both to complete. await s1.closed; await allDone.promise; diff --git a/test/parallel/test-quic-stream-many-rapid.mjs b/test/parallel/test-quic-stream-many-rapid.mjs index d80f94a20415..b845f210a299 100644 --- a/test/parallel/test-quic-stream-many-rapid.mjs +++ b/test/parallel/test-quic-stream-many-rapid.mjs @@ -40,7 +40,7 @@ await clientSession.opened; // Open 50 streams rapidly, each with a small body. const streams = []; for (let i = 0; i < streamCount; i++) { - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: encoder.encode('hello'), }); streams.push(stream); diff --git a/test/parallel/test-quic-stream-onblocked.mjs b/test/parallel/test-quic-stream-onblocked.mjs index 891c3a90911c..469f13cad4a2 100644 --- a/test/parallel/test-quic-stream-onblocked.mjs +++ b/test/parallel/test-quic-stream-onblocked.mjs @@ -50,7 +50,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); let blockedCount = 0; stream.onblocked = mustCallAtLeast(() => { diff --git a/test/parallel/test-quic-stream-pending.mjs b/test/parallel/test-quic-stream-pending.mjs index b9f4fc58c0d3..096e0474c871 100644 --- a/test/parallel/test-quic-stream-pending.mjs +++ b/test/parallel/test-quic-stream-pending.mjs @@ -34,7 +34,7 @@ const clientSession = await connect(serverEndpoint.address); // Create a stream BEFORE awaiting opened — the handshake may not have // completed yet. The stream should be created in a pending state. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('pending stream'), }); diff --git a/test/parallel/test-quic-stream-priority.mjs b/test/parallel/test-quic-stream-priority.mjs index 2895a5763c42..c8dbb6ef2ddb 100644 --- a/test/parallel/test-quic-stream-priority.mjs +++ b/test/parallel/test-quic-stream-priority.mjs @@ -37,7 +37,7 @@ const streamClosedPromises = []; // Test 1: Priority getter returns null for non-HTTP/3 sessions. // setPriority throws because the session doesn't support priority. { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); streamClosedPromises.push(stream.closed); assert.strictEqual(stream.priority, null); @@ -49,27 +49,27 @@ const streamClosedPromises = []; // Test 2: Validation of createStream priority/incremental options { - await assert.rejects( - clientSession.createBidirectionalStream({ priority: 'urgent' }), + assert.throws( + () => clientSession.createBidirectionalStream({ priority: 'urgent' }), { code: 'ERR_INVALID_ARG_VALUE' }, ); - await assert.rejects( - clientSession.createBidirectionalStream({ priority: 42 }), + assert.throws( + () => clientSession.createBidirectionalStream({ priority: 42 }), { code: 'ERR_INVALID_ARG_VALUE' }, ); - await assert.rejects( - clientSession.createBidirectionalStream({ incremental: 'yes' }), + assert.throws( + () => clientSession.createBidirectionalStream({ incremental: 'yes' }), { code: 'ERR_INVALID_ARG_TYPE' }, ); - await assert.rejects( - clientSession.createBidirectionalStream({ incremental: 1 }), + assert.throws( + () => clientSession.createBidirectionalStream({ incremental: 1 }), { code: 'ERR_INVALID_ARG_TYPE' }, ); } // Test 3: setPriority throws on non-H3 sessions regardless of arguments { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); streamClosedPromises.push(stream.closed); assert.throws( diff --git a/test/parallel/test-quic-stream-read-after-blocked.mjs b/test/parallel/test-quic-stream-read-after-blocked.mjs index 40ee0e9ea933..268ded0d090d 100644 --- a/test/parallel/test-quic-stream-read-after-blocked.mjs +++ b/test/parallel/test-quic-stream-read-after-blocked.mjs @@ -35,7 +35,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Write a byte to open the stream: -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); await stream.writer.write(new Uint8Array([1])); // Wait until the sender has filled the window and blocked. diff --git a/test/parallel/test-quic-stream-read-after-fin.mjs b/test/parallel/test-quic-stream-read-after-fin.mjs index 394a595a0d74..74dc7d008b9c 100644 --- a/test/parallel/test-quic-stream-read-after-fin.mjs +++ b/test/parallel/test-quic-stream-read-after-fin.mjs @@ -30,7 +30,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); // Write a byte to open the stream: const writer = stream.writer; diff --git a/test/parallel/test-quic-stream-recv-coalescing.mjs b/test/parallel/test-quic-stream-recv-coalescing.mjs index b493d5eea8ec..d6d7d43e8cea 100644 --- a/test/parallel/test-quic-stream-recv-coalescing.mjs +++ b/test/parallel/test-quic-stream-recv-coalescing.mjs @@ -111,7 +111,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); const w = stream.writer; for (let i = 0; i < payloadSizes.length; i++) { diff --git a/test/parallel/test-quic-stream-reset-after-data.mjs b/test/parallel/test-quic-stream-reset-after-data.mjs index d27abfc514e9..81f245744ba8 100644 --- a/test/parallel/test-quic-stream-reset-after-data.mjs +++ b/test/parallel/test-quic-stream-reset-after-data.mjs @@ -43,7 +43,7 @@ await clientSession.opened; // Send a small body — it will be sent quickly (including FIN), // putting the stream in "Data Sent" state. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('small payload'), }); diff --git a/test/parallel/test-quic-stream-reset-before-data.mjs b/test/parallel/test-quic-stream-reset-before-data.mjs index 0a6976aa2e09..d3e1d363bf3d 100644 --- a/test/parallel/test-quic-stream-reset-before-data.mjs +++ b/test/parallel/test-quic-stream-reset-before-data.mjs @@ -58,7 +58,7 @@ const clientSession = await connect(serverEndpoint.address, { await clientSession.opened; // Create a bidi stream but do NOT write any data. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); // Reset immediately — no data was ever written. This sends // RESET_STREAM to the server which implicitly creates the bidi diff --git a/test/parallel/test-quic-stream-reset-mid-transfer.mjs b/test/parallel/test-quic-stream-reset-mid-transfer.mjs index 252944bf2ada..faa237977410 100644 --- a/test/parallel/test-quic-stream-reset-mid-transfer.mjs +++ b/test/parallel/test-quic-stream-reset-mid-transfer.mjs @@ -44,7 +44,7 @@ await clientSession.opened; // Send a large body — with the 256-byte flow control window, the // transfer will be in progress when we reset. -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.setBody(new Uint8Array(8192)); // Wait for the server to receive the stream (first STREAM frames). diff --git a/test/parallel/test-quic-stream-reset-stop.mjs b/test/parallel/test-quic-stream-reset-stop.mjs index 7a2b8301f1f5..238db8656a44 100644 --- a/test/parallel/test-quic-stream-reset-stop.mjs +++ b/test/parallel/test-quic-stream-reset-stop.mjs @@ -42,7 +42,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('will be reset'), }); diff --git a/test/parallel/test-quic-stream-setbody-errors.mjs b/test/parallel/test-quic-stream-setbody-errors.mjs index da045d764c2f..bd32af704972 100644 --- a/test/parallel/test-quic-stream-setbody-errors.mjs +++ b/test/parallel/test-quic-stream-setbody-errors.mjs @@ -29,7 +29,7 @@ await clientSession.opened; // Test 1: setBody after setBody throws. { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(encoder.encode('first')); assert.throws(() => stream.setBody(encoder.encode('second')), { @@ -43,7 +43,7 @@ await clientSession.opened; // Test 2: setBody after writer accessed throws. { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); // Access the writer — this prevents setBody from being used. const w = stream.writer; w.endSync(); diff --git a/test/parallel/test-quic-stream-slow-consumer.mjs b/test/parallel/test-quic-stream-slow-consumer.mjs index 58140c948ea2..d802520127d2 100644 --- a/test/parallel/test-quic-stream-slow-consumer.mjs +++ b/test/parallel/test-quic-stream-slow-consumer.mjs @@ -37,7 +37,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; let blockedCount = 0; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); // The actual number of blocks can vary on a range of factors. We're // only validating that blocking occurs at least once. diff --git a/test/parallel/test-quic-stream-stats.mjs b/test/parallel/test-quic-stream-stats.mjs index 986142439e49..2883d6c4e4f5 100644 --- a/test/parallel/test-quic-stream-stats.mjs +++ b/test/parallel/test-quic-stream-stats.mjs @@ -45,7 +45,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: payload, }); diff --git a/test/parallel/test-quic-stream-stop-sending-buffered.mjs b/test/parallel/test-quic-stream-stop-sending-buffered.mjs index 1d41635b4575..f7bc429bf575 100644 --- a/test/parallel/test-quic-stream-stop-sending-buffered.mjs +++ b/test/parallel/test-quic-stream-stop-sending-buffered.mjs @@ -34,7 +34,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); const clientClosed = stream.closed.catch(() => {}); const writer = stream.writer; writer.writeSync(new Uint8Array([1])); diff --git a/test/parallel/test-quic-stream-stop-sending-callback.mjs b/test/parallel/test-quic-stream-stop-sending-callback.mjs index e2eef4b38e03..7044558262a3 100644 --- a/test/parallel/test-quic-stream-stop-sending-callback.mjs +++ b/test/parallel/test-quic-stream-stop-sending-callback.mjs @@ -41,7 +41,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); stream.onreset = mustNotCall(); stream.onstopsending = mustCall((error) => { assert.strictEqual(error.errorCode, stopCode); diff --git a/test/parallel/test-quic-stream-stop-sending-interaction.mjs b/test/parallel/test-quic-stream-stop-sending-interaction.mjs index 0b3c79d1c130..fb0231860352 100644 --- a/test/parallel/test-quic-stream-stop-sending-interaction.mjs +++ b/test/parallel/test-quic-stream-stop-sending-interaction.mjs @@ -56,7 +56,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ body: encoder.encode('initial data'), }); clientStreamReady.resolve(); diff --git a/test/parallel/test-quic-stream-truncated-reads.mjs b/test/parallel/test-quic-stream-truncated-reads.mjs index 0fed12dbb6fc..662ea5a010ed 100644 --- a/test/parallel/test-quic-stream-truncated-reads.mjs +++ b/test/parallel/test-quic-stream-truncated-reads.mjs @@ -166,7 +166,7 @@ for (const truncatedReads of ['error', 'ignore']) { await session.opened; session.closed.catch(() => {}); - const stream = await session.createBidirectionalStream(); + const stream = session.createBidirectionalStream(); stream.closed.catch(() => {}); await writeAndAwaitAck(stream, 100); stream.resetStream(0n); diff --git a/test/parallel/test-quic-stream-uni-basic.mjs b/test/parallel/test-quic-stream-uni-basic.mjs index 97eae68f08c6..8847c7105b15 100644 --- a/test/parallel/test-quic-stream-uni-basic.mjs +++ b/test/parallel/test-quic-stream-uni-basic.mjs @@ -46,7 +46,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createUnidirectionalStream({ body }); +const stream = clientSession.createUnidirectionalStream({ body }); assert.strictEqual(stream.direction, 'uni'); // The client-side uni stream is write-only — async iteration yields nothing. diff --git a/test/parallel/test-quic-stream-uni-delayed-reader.mjs b/test/parallel/test-quic-stream-uni-delayed-reader.mjs index 45a233617161..a89951e3695f 100644 --- a/test/parallel/test-quic-stream-uni-delayed-reader.mjs +++ b/test/parallel/test-quic-stream-uni-delayed-reader.mjs @@ -19,7 +19,7 @@ const done = Promise.withResolvers(); const serverEndpoint = await listen(mustCall(async (serverSession) => { await serverSession.opened; - const stream = await serverSession.createUnidirectionalStream({ + const stream = serverSession.createUnidirectionalStream({ body: expected, }); await stream.closed; diff --git a/test/parallel/test-quic-stream-uni-no-onstream.mjs b/test/parallel/test-quic-stream-uni-no-onstream.mjs index 82960ecf626d..c91745a7ac6e 100644 --- a/test/parallel/test-quic-stream-uni-no-onstream.mjs +++ b/test/parallel/test-quic-stream-uni-no-onstream.mjs @@ -34,7 +34,7 @@ const clientSession = await connect(serverEndpoint.address, { await clientSession.opened; -await clientSession.createUnidirectionalStream({ +clientSession.createUnidirectionalStream({ body: 'something something darkside', }); diff --git a/test/parallel/test-quic-stream-uni-server-initiated.mjs b/test/parallel/test-quic-stream-uni-server-initiated.mjs index c4403a8dc85c..2bdd44e790d2 100644 --- a/test/parallel/test-quic-stream-uni-server-initiated.mjs +++ b/test/parallel/test-quic-stream-uni-server-initiated.mjs @@ -25,7 +25,7 @@ const done = Promise.withResolvers(); const serverEndpoint = await listen(mustCall(async (serverSession) => { await serverSession.opened; - const stream = await serverSession.createUnidirectionalStream({ + const stream = serverSession.createUnidirectionalStream({ body: encoder.encode(message), }); diff --git a/test/parallel/test-quic-stream-write-partial-view.mjs b/test/parallel/test-quic-stream-write-partial-view.mjs index 6abec5096cc4..a7770f3000db 100644 --- a/test/parallel/test-quic-stream-write-partial-view.mjs +++ b/test/parallel/test-quic-stream-write-partial-view.mjs @@ -44,7 +44,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); const writer = stream.writer; // First half. The underlying ArrayBuffer must stay live after the diff --git a/test/parallel/test-quic-stream-writer-api.mjs b/test/parallel/test-quic-stream-writer-api.mjs index 26f240e4878d..d9c7fe4ace2c 100644 --- a/test/parallel/test-quic-stream-writer-api.mjs +++ b/test/parallel/test-quic-stream-writer-api.mjs @@ -40,7 +40,7 @@ await clientSession.opened; // write() async { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const w = stream.writer; await w.write(encoder.encode('async write')); const n = w.endSync(); @@ -51,7 +51,7 @@ await clientSession.opened; // writevSync() vectored write { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const w = stream.writer; const result = w.writevSync([ encoder.encode('hello '), @@ -66,7 +66,7 @@ await clientSession.opened; // writev() async vectored write { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const w = stream.writer; await w.writev([ encoder.encode('async '), @@ -80,7 +80,7 @@ await clientSession.opened; // end() async close { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const w = stream.writer; w.writeSync(encoder.encode('end async')); const n = await w.end(); @@ -91,7 +91,7 @@ await clientSession.opened; // Web IDL Writer argument conversion { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const w = stream.writer; await w.write(42, null); await w.writev(new Set([true, { toString: () => 'object' }])); @@ -114,7 +114,7 @@ await clientSession.opened; } { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const w = stream.writer; // canWrite should be a boolean (false initially before flow // control window opens, or true if the window is already open). @@ -134,7 +134,7 @@ await clientSession.opened; // Return null when errored. { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const w = stream.writer; const reason = null; w.fail(reason); diff --git a/test/parallel/test-quic-stream-writer-dispose.mjs b/test/parallel/test-quic-stream-writer-dispose.mjs index 577294aa99eb..f06c2e533e6a 100644 --- a/test/parallel/test-quic-stream-writer-dispose.mjs +++ b/test/parallel/test-quic-stream-writer-dispose.mjs @@ -28,7 +28,7 @@ const clientSession = await connect(serverEndpoint.address, { }); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); const w = stream.writer; // Writer is active — canWrite should be a boolean (not null). diff --git a/test/parallel/test-quic-stream-writer-drain-unhandled-rejection.mjs b/test/parallel/test-quic-stream-writer-drain-unhandled-rejection.mjs index 6420de02ba95..1025b6f1b946 100644 --- a/test/parallel/test-quic-stream-writer-drain-unhandled-rejection.mjs +++ b/test/parallel/test-quic-stream-writer-drain-unhandled-rejection.mjs @@ -31,7 +31,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); const writer = stream.writer; // Write a small initial chunk so the server materializes the stream. diff --git a/test/parallel/test-quic-stream-writer-fail-error-code.mjs b/test/parallel/test-quic-stream-writer-fail-error-code.mjs index 36e1310b560c..a8e0a7c9a116 100644 --- a/test/parallel/test-quic-stream-writer-fail-error-code.mjs +++ b/test/parallel/test-quic-stream-writer-fail-error-code.mjs @@ -69,7 +69,7 @@ await clientSession.opened; // 1. Plain Error -> session.internalErrorCode (0x1n for non-h3). { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const writer = stream.writer; // Write a tiny chunk to guarantee the server-side stream is // created via onstream before the RESET_STREAM frame arrives. @@ -79,7 +79,7 @@ await clientSession.opened; // 2. QuicError with explicit code -> peer sees that exact code. { - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); const writer = stream.writer; writer.writeSync('y'); writer.fail(new QuicError('explicit code', { errorCode: 0x42n })); diff --git a/test/parallel/test-quic-stream-zero-length.mjs b/test/parallel/test-quic-stream-zero-length.mjs index 32f7bc524404..aa5ad4326b8e 100644 --- a/test/parallel/test-quic-stream-zero-length.mjs +++ b/test/parallel/test-quic-stream-zero-length.mjs @@ -32,7 +32,7 @@ const { bytes } = await import('stream/iter'); const clientSession = await connect(serverEndpoint.address); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream(); + const stream = clientSession.createBidirectionalStream(); stream.setBody(null); await dump(stream); @@ -61,7 +61,7 @@ const { bytes } = await import('stream/iter'); await clientSession.opened; const stream = - await clientSession.createBidirectionalStream({ body: null }); + clientSession.createBidirectionalStream({ body: null }); await dump(stream); diff --git a/test/parallel/test-quic-token-reuse.mjs b/test/parallel/test-quic-token-reuse.mjs index 3454eb03f051..4b21bec93e7c 100644 --- a/test/parallel/test-quic-token-reuse.mjs +++ b/test/parallel/test-quic-token-reuse.mjs @@ -38,7 +38,7 @@ const cs1 = await connect(serverEndpoint.address, { await Promise.all([cs1.opened, gotToken.promise]); // Signal the server to close this session. -const s1 = await cs1.createBidirectionalStream(); +const s1 = cs1.createBidirectionalStream(); s1.writer.endSync(); for await (const _ of s1) { /* drain */ } // eslint-disable-line no-unused-vars await Promise.all([s1.closed, cs1.closed]); @@ -50,7 +50,7 @@ const cs2 = await connect(serverEndpoint.address, { await cs2.opened; // Verify data transfer works on the second connection. -const s2 = await cs2.createBidirectionalStream(); +const s2 = cs2.createBidirectionalStream(); s2.writer.endSync(); for await (const _ of s2) { /* drain */ } // eslint-disable-line no-unused-vars await s2.closed; diff --git a/test/parallel/test-quic-worker-terminate.mjs b/test/parallel/test-quic-worker-terminate.mjs index edd7b2186c71..4941a7653d92 100644 --- a/test/parallel/test-quic-worker-terminate.mjs +++ b/test/parallel/test-quic-worker-terminate.mjs @@ -29,7 +29,7 @@ if (!isMainThread) { const clientSession = await connect(serverEndpoint.address); clientSession.closed.catch(() => {}); await clientSession.opened; - const stream = await clientSession.createBidirectionalStream({ + const stream = clientSession.createBidirectionalStream({ body: new Uint8Array(1), }); stream.closed.catch(() => {}); diff --git a/test/parallel/test-quic-writer-abort-signal.mjs b/test/parallel/test-quic-writer-abort-signal.mjs index edd3415c4152..950388448b4b 100644 --- a/test/parallel/test-quic-writer-abort-signal.mjs +++ b/test/parallel/test-quic-writer-abort-signal.mjs @@ -27,7 +27,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ budget: 1024 }); +const stream = clientSession.createBidirectionalStream({ budget: 1024 }); const w = stream.writer; // Create an already-aborted signal. diff --git a/test/parallel/test-quic-writer-async-dispose-ended.mjs b/test/parallel/test-quic-writer-async-dispose-ended.mjs index d309f0eed8c5..e2d7c32ada59 100644 --- a/test/parallel/test-quic-writer-async-dispose-ended.mjs +++ b/test/parallel/test-quic-writer-async-dispose-ended.mjs @@ -29,7 +29,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream(); +const stream = clientSession.createBidirectionalStream(); const w = stream.writer; // End the writer normally. diff --git a/test/parallel/test-quic-writer-backpressure.mjs b/test/parallel/test-quic-writer-backpressure.mjs index b9422e917c54..d06985908637 100644 --- a/test/parallel/test-quic-writer-backpressure.mjs +++ b/test/parallel/test-quic-writer-backpressure.mjs @@ -38,7 +38,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { const clientSession = await connect(serverEndpoint.address); await clientSession.opened; -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ budget: 2048, }); const w = stream.writer; diff --git a/test/parallel/test-quic-writer-write-rejects.mjs b/test/parallel/test-quic-writer-write-rejects.mjs index 3c4d697d7e43..6a18d2f3af31 100644 --- a/test/parallel/test-quic-writer-write-rejects.mjs +++ b/test/parallel/test-quic-writer-write-rejects.mjs @@ -29,7 +29,7 @@ const clientSession = await connect(serverEndpoint.address); await clientSession.opened; // Use a small budget to trigger backpressure easily. -const stream = await clientSession.createBidirectionalStream({ +const stream = clientSession.createBidirectionalStream({ budget: 1024, }); const w = stream.writer; diff --git a/test/parallel/test-quic-zero-rtt-disabled-server.mjs b/test/parallel/test-quic-zero-rtt-disabled-server.mjs index b1190e8379e2..5cfede792267 100644 --- a/test/parallel/test-quic-zero-rtt-disabled-server.mjs +++ b/test/parallel/test-quic-zero-rtt-disabled-server.mjs @@ -122,7 +122,7 @@ const alpn = ['quic-test']; sessionTicket: ticket, }); - await client2.createUnidirectionalStream({ + client2.createUnidirectionalStream({ body: 'hello from 0-RTT', }); diff --git a/test/parallel/test-quic-zero-rtt-rejected-settings.mjs b/test/parallel/test-quic-zero-rtt-rejected-settings.mjs index 912f9d94e410..8416c3ef28fa 100644 --- a/test/parallel/test-quic-zero-rtt-rejected-settings.mjs +++ b/test/parallel/test-quic-zero-rtt-rejected-settings.mjs @@ -95,7 +95,7 @@ const cs2 = await connect(ep2.address, { // Trigger the deferred handshake. const encoder = new TextEncoder(); -await cs2.createBidirectionalStream({ +cs2.createBidirectionalStream({ body: encoder.encode('test'), }); diff --git a/test/parallel/test-quic-zero-rtt.mjs b/test/parallel/test-quic-zero-rtt.mjs index 47baf3ac732b..01dd955c6972 100644 --- a/test/parallel/test-quic-zero-rtt.mjs +++ b/test/parallel/test-quic-zero-rtt.mjs @@ -74,7 +74,7 @@ assert.strictEqual(info1.earlyDataAccepted, false); await Promise.all([gotTicket.promise, gotToken.promise]); // Send data to verify the connection works. -const s1 = await cs1.createBidirectionalStream({ +const s1 = cs1.createBidirectionalStream({ body: encoder.encode('first'), }); await dump(s1); @@ -90,7 +90,7 @@ const cs2 = await connect(serverEndpoint.address, { }); // Send data BEFORE the handshake completes — true 0-RTT. -const s2 = await cs2.createBidirectionalStream(); +const s2 = cs2.createBidirectionalStream(); await s2.writer.write(encoder.encode('early data')); // Now wait for handshake completion.