Skip to content

CrudApiPlugin: Support query string parameters in actions#1759

Draft
garrytrinder with Copilot wants to merge 3 commits into
mainfrom
copilot/add-support-query-string-parameters
Draft

CrudApiPlugin: Support query string parameters in actions#1759
garrytrinder with Copilot wants to merge 3 commits into
mainfrom
copilot/add-support-query-string-parameters

Conversation

Copilot AI commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

CrudApiPlugin actions only matched on URL path segments. Query string parameter filtering (e.g., GET /jokes?category=azure) was not possible.

Changes

  • Split action URL into path and query parts at ? delimiter
  • Match path against request path (preserving existing behavior)
  • Match query parameters individually using HttpUtility.ParseQueryString — order-independent
  • Support parameterized values ({param}) extracted into the parameters dictionary for JSONPath substitution
  • Support literal query values with exact-match validation

Example

{
  "action": "getMany",
  "url": "?category={category}",
  "query": "$.[?(@.categories[?(@ == '{category}')])]"
}

GET /baseUrl?category=azure extracts azure as {category} and substitutes it into the JSONPath query to filter matching items.

Copilot AI changed the title [WIP] Add support for query string parameters in actions CrudApiPlugin: Support query string parameters in actions Jul 13, 2026
Copilot AI requested a review from garrytrinder July 13, 2026 15:30
@garrytrinder
garrytrinder requested a review from Copilot July 17, 2026 15:46

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.

Pull request overview

Adds query-string-aware action matching to CrudApiPlugin, enabling scenarios like GET /resource?category=azure to select the correct action and extract query parameters for JSONPath substitution.

Changes:

  • Split configured action URLs into path + query portions and match the path portion (including {param} extraction).
  • Add order-independent query parameter matching with support for {param} placeholders and literal values.
  • Update DevProxy/packages.lock.json to reflect the restored dependency graph.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
DevProxy.Plugins/Mocking/CrudApiPlugin.cs Implements query string parsing/matching and parameter extraction for CRUD actions.
DevProxy/packages.lock.json Updates locked dependency graph after restore.

if (paramMatch.Success)
{
var paramName = paramMatch.Groups[1].Value.Replace('-', '_');
parameters[paramName] = Uri.UnescapeDataString(requestValue);
var paramName = paramMatch.Groups[1].Value.Replace('-', '_');
parameters[paramName] = Uri.UnescapeDataString(requestValue);
}
else if (!string.Equals(actionValue, requestValue, StringComparison.OrdinalIgnoreCase))
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.

CrudApiPlugin: Support query string parameters in actions

3 participants