Description
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
.