Skip to content

Efficient removing of QueryString parameters #23971

Open
@jmezach

Description

@jmezach

Is your feature request related to a problem? Please describe.

I'm currently working on pull request dotnet/yarp#301 for YARP to add support for transforming query parameters on the incoming request to downstream services. One thing that seems useful is to allow YARP to remove query parameters on the incoming request when they flow to the downstream by configuring a transformation. Currently this involves parsing the entire query string into a Dictionary using QueryHelpers.Parse(), removing the parameter we want and then using the QueryBuilder class to put it all back into a QueryString instance.

This feels a little bit wasteful in terms of performance since we're allocating a dictionary and doing a whole bunch of string parsing, only to remove a single query parameter.

Describe the solution you'd like

Since the QueryString class already has an Add method it makes sense to add a Remove (or Delete if that's more appropriate) method to the QueryString that strips a query parameter from the query string in the most efficient way and returns a new QueryString.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected-very-fewThis issue impacts very few customersarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-yarpThis issue is related to work on yarpseverity-nice-to-haveThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions