Skip to content

Commit e02e816

Browse files
dependabot[bot]parkerbxyzCopilot
authored
build(deps-dev): bump undici from 7.24.6 to 8.2.0 (#366)
Bumps [undici](https://github.com/nodejs/undici) from 7.24.6 to 8.2.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/nodejs/undici/releases">undici's releases</a>.</em></p> <blockquote> <h2>v8.2.0</h2> <h2>What's Changed</h2> <ul> <li>chore: use native addAbortListener by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5021">nodejs/undici#5021</a></li> <li>fix: fix the logic for the UNDICI_NO_WASM_SIMD environment variable by <a href="https://github.com/ShenHongFei"><code>@​ShenHongFei</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5026">nodejs/undici#5026</a></li> <li>fix(http2): send body for non-expectsPayload methods with content by <a href="https://github.com/mcollina"><code>@​mcollina</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5030">nodejs/undici#5030</a></li> <li>fix(fetch): correct 'navigator' typo to 'navigate' in fetchFinale by <a href="https://github.com/deepview-autofix"><code>@​deepview-autofix</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5044">nodejs/undici#5044</a></li> <li>fix(webidl): correct signed integer bounds in ConvertToInt by <a href="https://github.com/deepview-autofix"><code>@​deepview-autofix</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5038">nodejs/undici#5038</a></li> <li>fix(fetch): use || for CRLF check in multipart formdata-parser by <a href="https://github.com/deepview-autofix"><code>@​deepview-autofix</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5049">nodejs/undici#5049</a></li> <li>fix(websocket): correct argument order in WebSocketStream UTF-8 failure by <a href="https://github.com/deepview-autofix"><code>@​deepview-autofix</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5050">nodejs/undici#5050</a></li> <li>fix(pool): propagate useH2c to connector when connections &gt; 1 by <a href="https://github.com/SAY-5"><code>@​SAY-5</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5031">nodejs/undici#5031</a></li> <li>fix(cache): return immutable staleAt in milliseconds by <a href="https://github.com/deepview-autofix"><code>@​deepview-autofix</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5048">nodejs/undici#5048</a></li> <li>fix(socks5-proxy-agent): use per-origin pools to prevent cross-origin routing by <a href="https://github.com/deepview-autofix"><code>@​deepview-autofix</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5041">nodejs/undici#5041</a></li> <li>fix(cache): evict oldest entries first in SqliteCacheStore prune by <a href="https://github.com/deepview-autofix"><code>@​deepview-autofix</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5039">nodejs/undici#5039</a></li> <li>fix(socks5): correctly expand IPv6 '::' compressed notation by <a href="https://github.com/deepview-autofix"><code>@​deepview-autofix</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5046">nodejs/undici#5046</a></li> <li>Remove unused func and unnecessary shim by <a href="https://github.com/tsctx"><code>@​tsctx</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5053">nodejs/undici#5053</a></li> <li>fix: reject malformed content-length request headers by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5060">nodejs/undici#5060</a></li> <li>fix(request): reject NaN highWaterMark during option validation by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5062">nodejs/undici#5062</a></li> <li>docs: fix broken links in docsify sidebar by <a href="https://github.com/maruthang"><code>@​maruthang</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5065">nodejs/undici#5065</a></li> <li>fix(fetch): prefer filename* over filename in multipart form-data by <a href="https://github.com/maruthang"><code>@​maruthang</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5068">nodejs/undici#5068</a></li> <li>fix(http2): reject websocket upgrades on non-200 responses by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5072">nodejs/undici#5072</a></li> <li>feat: support username-only proxy authentication in ProxyAgent by <a href="https://github.com/rossilor95"><code>@​rossilor95</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/4935">nodejs/undici#4935</a></li> <li>build(deps): bump uWebSockets.js from v20.58.0 to v20.64.0 in /benchmarks by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot] in <a href="https://redirect.github.com/nodejs/undici/pull/5083">nodejs/undici#5083</a></li> <li>fix(client-h2): stop double-decrementing kOpenStreams on stream timeout by <a href="https://github.com/SAY-5"><code>@​SAY-5</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5076">nodejs/undici#5076</a></li> <li>fix(http2): reject upgrade streams closed before response headers by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5069">nodejs/undici#5069</a></li> <li>fix(http2): allow GET and HEAD request bodies over h2 by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5058">nodejs/undici#5058</a></li> <li>fix(cache): include query in cache key when opts.path is undefined by <a href="https://github.com/maruthang"><code>@​maruthang</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5081">nodejs/undici#5081</a></li> <li>fix: avoid premature cleanup of dispatcher in Agent by <a href="https://github.com/bienzaaron"><code>@​bienzaaron</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5034">nodejs/undici#5034</a></li> <li>fix(http2): record ping failures on the socket by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5075">nodejs/undici#5075</a></li> <li>add undici security policy by <a href="https://github.com/mcollina"><code>@​mcollina</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5056">nodejs/undici#5056</a></li> <li>fix(mock): make filterCalls AND operator actually intersect results by <a href="https://github.com/deepview-autofix"><code>@​deepview-autofix</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5045">nodejs/undici#5045</a></li> <li>fix(socks5): enforce authenticated state before CONNECT by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5097">nodejs/undici#5097</a></li> <li>fix(cache): skip expired sqlite vary entries during lookup by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5095">nodejs/undici#5095</a></li> <li>fix: enforce maxCachedSessions in TLS session cache by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5102">nodejs/undici#5102</a></li> <li>fix(socks5): encode embedded IPv4 tails in IPv6 literals correctly by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5099">nodejs/undici#5099</a></li> <li>fix: handle invalid HTTP/2 connection headers (<a href="https://redirect.github.com/nodejs/undici/issues/4356">#4356</a>) by <a href="https://github.com/mcollina"><code>@​mcollina</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5101">nodejs/undici#5101</a></li> <li>fix(interceptor): add throwOnMaxRedirect to types and interceptor opts by <a href="https://github.com/maruthang"><code>@​maruthang</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5066">nodejs/undici#5066</a></li> <li>fix(websocket): avoid double-closing canceled stream readers by <a href="https://github.com/colinaaa"><code>@​colinaaa</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5105">nodejs/undici#5105</a></li> <li>fix(cache): persist vary when updating sqlite cache entries by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5109">nodejs/undici#5109</a></li> <li>refactor(h1): track HEAD keep-alive override as boolean by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5110">nodejs/undici#5110</a></li> <li>client: cache llhttp wasm buffer view by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5115">nodejs/undici#5115</a></li> <li>deps: update llhttp to 9.3.1 by <a href="https://github.com/mcollina"><code>@​mcollina</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5113">nodejs/undici#5113</a></li> <li>fix(http2): preserve accepted streams after GOAWAY by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5090">nodejs/undici#5090</a></li> <li>fix: reuse parser WeakRef for timeout callbacks by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5125">nodejs/undici#5125</a></li> <li>fix: stop buffering data after SOCKS5 connect by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5118">nodejs/undici#5118</a></li> <li>perf(http2): avoid response header reserialization by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5085">nodejs/undici#5085</a></li> <li>fix(cache): enforce sqlite maxCount after insert by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5112">nodejs/undici#5112</a></li> <li>perf: reduce EventSourceStream parser allocations by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5032">nodejs/undici#5032</a></li> <li>types(dispatcher): use OutgoingHttpHeaders for request headers by <a href="https://github.com/maruthang"><code>@​maruthang</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5067">nodejs/undici#5067</a></li> <li>cleanup: delete redundant .gitkeep file by <a href="https://github.com/shivarm"><code>@​shivarm</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5133">nodejs/undici#5133</a></li> <li>fix(http2): respect peer max concurrent streams by <a href="https://github.com/trivikr"><code>@​trivikr</code></a> in <a href="https://redirect.github.com/nodejs/undici/pull/5135">nodejs/undici#5135</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/nodejs/undici/commit/bf684f7de01616708a33a5d1c092177622394442"><code>bf684f7</code></a> Bumped v8.2.0 (<a href="https://redirect.github.com/nodejs/undici/issues/5152">#5152</a>)</li> <li><a href="https://github.com/nodejs/undici/commit/0ca054aa8524ed52709ebf15e94e187f4a18ebcf"><code>0ca054a</code></a> fix: replace stale pool clients under connection limit (<a href="https://redirect.github.com/nodejs/undici/issues/5145">#5145</a>)</li> <li><a href="https://github.com/nodejs/undici/commit/7af90e9721f882bb5fc97606e3f95217ca849994"><code>7af90e9</code></a> perf: avoid redundant scans in BalancedPool dispatcher selection (<a href="https://redirect.github.com/nodejs/undici/issues/5146">#5146</a>)</li> <li><a href="https://github.com/nodejs/undici/commit/abb9d06ba7b882d336129898f9e89176f1c8f1c3"><code>abb9d06</code></a> fix: validate H2CClient maxConcurrentStreams option (<a href="https://redirect.github.com/nodejs/undici/issues/5143">#5143</a>)</li> <li><a href="https://github.com/nodejs/undici/commit/72a75913138bc6197bf0620a1291f7c2e764c430"><code>72a7591</code></a> perf(http2): avoid cloning headers when removing status (<a href="https://redirect.github.com/nodejs/undici/issues/5127">#5127</a>)</li> <li><a href="https://github.com/nodejs/undici/commit/96fd5e9da9b19a4d49eb9e67534f73f4cfa1c677"><code>96fd5e9</code></a> fix(cache): allow streamed entries at maxEntrySize limit (<a href="https://redirect.github.com/nodejs/undici/issues/5129">#5129</a>)</li> <li><a href="https://github.com/nodejs/undici/commit/f41e53f112659ec37b6fa8db4e4f39388b9e6ca6"><code>f41e53f</code></a> perf: use byteLength property for binary body chunks (<a href="https://redirect.github.com/nodejs/undici/issues/5126">#5126</a>)</li> <li><a href="https://github.com/nodejs/undici/commit/bec49615931e3df3df4f75956b35c3f7f1fd05ca"><code>bec4961</code></a> chore(deps): add lockfile (<a href="https://redirect.github.com/nodejs/undici/issues/5139">#5139</a>)</li> <li><a href="https://github.com/nodejs/undici/commit/86f1242cfc86364fe5c30d7e0fc1deec8d52954b"><code>86f1242</code></a> perf(http2): reduce writeH2 per-request callback allocations (<a href="https://redirect.github.com/nodejs/undici/issues/5138">#5138</a>)</li> <li><a href="https://github.com/nodejs/undici/commit/cad3f70a86b95966a3e368f9f7118377858b8c3e"><code>cad3f70</code></a> perf(client): parse h1 content-length statelessly (<a href="https://redirect.github.com/nodejs/undici/issues/5124">#5124</a>)</li> <li>Additional commits viewable in <a href="https://github.com/nodejs/undici/compare/v7.24.6...v8.2.0">compare view</a></li> </ul> </details> <br /> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Parker Brown <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 8d835bf commit e02e816

9 files changed

Lines changed: 35 additions & 27 deletions

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"c8": "^11.0.0",
2828
"esbuild": "^0.28.0",
2929
"open-cli": "^9.0.0",
30-
"undici": "^7.24.6",
30+
"undici": "^8.2.0",
3131
"yaml": "^2.8.3"
3232
}
3333
}

tests/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ function normalizeStderr(stderr) {
2222
const files = readdirSync("tests");
2323

2424
// Files to ignore
25-
const ignore = ["index.js", "index.js.snapshot", "main.js", "README.md"];
25+
const ignore = [
26+
"index.js",
27+
"index.js.snapshot",
28+
"main.js",
29+
"mock-agent.js",
30+
"README.md",
31+
];
2632

2733
const testFiles = files.filter((file) => !ignore.includes(file)).sort();
2834

tests/main.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Base for all `main` tests.
22
// @ts-check
3-
import { MockAgent, setGlobalDispatcher } from "undici";
3+
import { createMockAgent } from "./mock-agent.js";
44

55
export const DEFAULT_ENV = {
66
GITHUB_REPOSITORY_OWNER: "actions",
@@ -50,9 +50,7 @@ export async function test(cb = (_mockPool) => {}, env = DEFAULT_ENV) {
5050
// Set up mocking
5151
const baseUrl = new URL(env["INPUT_GITHUB-API-URL"]);
5252
const basePath = baseUrl.pathname === "/" ? "" : baseUrl.pathname;
53-
const mockAgent = new MockAgent({ enableCallHistory: true });
54-
mockAgent.disableNetConnect();
55-
setGlobalDispatcher(mockAgent);
53+
const mockAgent = createMockAgent({ enableCallHistory: true });
5654
const mockPool = mockAgent.get(baseUrl.origin);
5755

5856
// Calling `auth({ type: "app" })` to obtain a JWT doesn’t make network requests, so no need to intercept.

tests/mock-agent.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { install, MockAgent, setGlobalDispatcher } from "undici";
2+
3+
// Ensure MockAgent intercepts requests made through global fetch.
4+
install();
5+
6+
export function createMockAgent(options) {
7+
const mockAgent = new MockAgent(options);
8+
mockAgent.disableNetConnect();
9+
setGlobalDispatcher(mockAgent);
10+
11+
return mockAgent;
12+
}

tests/post-revoke-token-fail-response.test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MockAgent, setGlobalDispatcher } from "undici";
1+
import { createMockAgent } from "./mock-agent.js";
22

33
// state variables are set as environment variables with the prefix STATE_
44
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#sending-values-to-the-pre-and-post-actions
@@ -14,9 +14,7 @@ process.env.STATE_expiresAt = new Date(
1414
Date.now() + 1000 * 60 * 60
1515
).toISOString();
1616

17-
const mockAgent = new MockAgent();
18-
19-
setGlobalDispatcher(mockAgent);
17+
const mockAgent = createMockAgent();
2018

2119
// Provide the base url to the request
2220
const mockPool = mockAgent.get("https://api.github.com");

tests/post-token-expired.test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MockAgent, setGlobalDispatcher } from "undici";
1+
import { createMockAgent } from "./mock-agent.js";
22

33
// state variables are set as environment variables with the prefix STATE_
44
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#sending-values-to-the-pre-and-post-actions
@@ -11,9 +11,7 @@ process.env.STATE_expiresAt = new Date(Date.now() - 1000 * 60 * 60).toISOString(
1111
// https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
1212
process.env["INPUT_SKIP-TOKEN-REVOKE"] = "false";
1313

14-
const mockAgent = new MockAgent();
15-
16-
setGlobalDispatcher(mockAgent);
14+
const mockAgent = createMockAgent();
1715

1816
// Provide the base url to the request
1917
const mockPool = mockAgent.get("https://api.github.com");

tests/post-token-set.test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MockAgent, setGlobalDispatcher } from "undici";
1+
import { createMockAgent } from "./mock-agent.js";
22

33
// state variables are set as environment variables with the prefix STATE_
44
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#sending-values-to-the-pre-and-post-actions
@@ -12,9 +12,7 @@ process.env["INPUT_SKIP-TOKEN-REVOKE"] = "false";
1212
// 1 hour in the future, not expired
1313
process.env.STATE_expiresAt = new Date(Date.now() + 1000 * 60 * 60).toISOString();
1414

15-
const mockAgent = new MockAgent();
16-
17-
setGlobalDispatcher(mockAgent);
15+
const mockAgent = createMockAgent();
1816

1917
// Provide the base url to the request
2018
const mockPool = mockAgent.get("https://api.github.com");

tests/post-token-skipped.test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MockAgent, setGlobalDispatcher } from "undici";
1+
import { createMockAgent } from "./mock-agent.js";
22

33
// state variables are set as environment variables with the prefix STATE_
44
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#sending-values-to-the-pre-and-post-actions
@@ -8,9 +8,7 @@ process.env.STATE_token = "secret123";
88
// https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
99
process.env["INPUT_SKIP-TOKEN-REVOKE"] = "true";
1010

11-
const mockAgent = new MockAgent();
12-
13-
setGlobalDispatcher(mockAgent);
11+
const mockAgent = createMockAgent();
1412

1513
// Provide the base url to the request
1614
const mockPool = mockAgent.get("https://api.github.com");

0 commit comments

Comments
 (0)