#8792 fetchMock doesn't intercept requests with square brackets in query parameters
Upstream fix exists in undici (acceptNonStandardSearchParameters option) and workers-sdk has updated undici. vitest-pool-workers needs to pass this option when creating MockAgent.
Implement one-line fix in fetch-mock.ts to pass acceptNonStandardSearchParameters: true
Analysis Report
Issue Review: cloudflare/workers-sdk#8792
Summary
fetchMock from cloudflare:test doesn't intercept requests with square brackets in query parameters (e.g., arraykey[]=a&arraykey[]=b).
Findings
- Created: 2025-04-04
- Updated: 2025-10-30
- Version: vitest-pool-workers@0.8.10 → 0.12.6
- Component: vitest-pool-workers
- Labels: bug
- Comments: 1
Key Evidence
Upstream fix exists but not applied: The root cause was in undici's
MockAgent. Fixed via nodejs/undici#4148 (merged April 21, 2025) which addedacceptNonStandardSearchParametersoption.Workers-sdk has updated undici: PR #11967 (merged Jan 19, 2026) updated undici from 7.14.0 to 7.18.2, which includes the fix.
Fix not utilized: The current
fetch-mock.tscreatesMockAgentas:export const fetchMock = new MockAgent({ connections: 1 });It does NOT pass
acceptNonStandardSearchParameters: true, so the fix is not active.Maintainer confirmed upstream: @dario-piotrowicz identified this as an undici issue and created the upstream issue which has now been fixed.
Recommendation
Status: KEEP OPEN
Reasoning: The upstream fix in undici is available and workers-sdk has updated to a version that includes it. However, vitest-pool-workers needs to be modified to pass acceptNonStandardSearchParameters: true when creating the MockAgent instance. This is a straightforward fix.
Action: Implement the fix by updating fetch-mock.ts to use the new undici option:
export const fetchMock = new MockAgent({
connections: 1,
acceptNonStandardSearchParameters: true
});
Suggested Comment
The upstream fix is now available. Undici added the
acceptNonStandardSearchParametersoption in nodejs/undici#4148, and workers-sdk has updated to undici 7.18.2 which includes this fix.To resolve this issue,
vitest-pool-workersneeds to be updated to pass this option when creating the MockAgent:export const fetchMock = new MockAgent({ connections: 1, acceptNonStandardSearchParameters: true });This would be a simple one-line change in
packages/vitest-pool-workers/src/worker/fetch-mock.ts.
Notes & Feedback (0)
No notes yet.