Skip to content

Make mock and error-response URL matching case-insensitive - #1934

Open
waldekmastykarz with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-case-sensitive-url-matching
Open

waldekmastykarz with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-case-sensitive-url-matching

Conversation

Copilot AI commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

urlsToWatch matching ignores case, but mock and error-response URL matching was case-sensitive. A request that Dev Proxy intercepted could fail to match a mock or error entry that differed only in casing, and then pass through to the origin with no warning.

Changes

  • MockResponsePlugin, GraphMockResponsePlugin, GenericRandomErrorPlugin: both URL checks now ignore case. The exact-URL check uses StringComparison.OrdinalIgnoreCase instead of ==, and the wildcard regex uses RegexOptions.IgnoreCase.
  • WebSocketMockResponsePlugin: the wildcard regex now uses RegexOptions.IgnoreCase. Its exact-URL match already ignored case.
  • Tests: integration tests for MockResponsePlugin and GenericRandomErrorPlugin check that a request to /get matches entries defined as /Get (exact) and /Ge* (wildcard).

Behavior

// urlsToWatch: ["https://api.contoso.com/*"]
{ "request": { "url": "https://api.contoso.com/Users" }, ... }

GET https://api.contoso.com/users now returns the mock. Before this change, the request was intercepted but no mock matched.

Compatibility

Matching is more permissive now. Within each file, entries are still evaluated in order and the first match wins. A mocks or errors file that relies on casing to tell two entries apart will now resolve to whichever of them comes first.

Copilot AI and others added 2 commits October 20, 2026 10:50


Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix case-sensitive URL matching in mock and error-response Make mock and error-response URL matching case-insensitive Oct 20, 2026
Copilot AI requested a review from waldekmastykarz October 20, 2026 10:53
@waldekmastykarz
waldekmastykarz marked this pull request as ready for review October 20, 2026 17:49
@waldekmastykarz
waldekmastykarz requested a review from a team as a code owner October 20, 2026 17:49
Copilot AI balanced review requested due to automatic review settings October 20, 2026 17:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Static review found no blocking issues, and regression tests cover exact and wildcard HTTP matching, though tests were not executed.

No open issues 🎉

What changed in this PR

Aligns mock and error-response URL matching with case-insensitive urlsToWatch behavior, addressing #1931.

Changes:

  • Makes exact and wildcard URL matching ignore case across four plugins.
  • Adds integration tests for mixed-case exact and wildcard matches.
  • Updates transitive dependency lock-file entries.
File Description
DevProxy/​packages.lock.json Updates application dependency records.
DevProxy.Proxy.Kestrel/​packages.lock.json Updates proxy dependency records.
DevProxy.Plugins/​Mocking/​WebSocketMockResponsePlugin.cs Makes wildcard matching case-insensitive.
DevProxy.Plugins/​Mocking/​MockResponsePlugin.cs Makes exact and wildcard matching case-insensitive.
DevProxy.Plugins/​Mocking/​GraphMockResponsePlugin.cs Applies case-insensitive matching to batch requests.
DevProxy.Plugins/​Behavior/​GenericRandomErrorPlugin.cs Makes error-entry URL matching case-insensitive.
DevProxy.Integration.Tests/​ManipulationAndMockingIntegrationTests.cs Tests mixed-case mock matching.
DevProxy.Integration.Tests/​BehaviorPluginsIntegrationTests.cs Tests mixed-case error matching.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mock and error-response URL matching is case-sensitive while urlsToWatch is case-insensitive

3 participants