Change multiple of the same parameter in middleware

We are trying to modify the url parameters of a call; what we are trying to do seemed beyond the ability of the URL Rewrite feature so we’ve attempted to do it in middleware

Our URIs look like this:

in request.Params[filter] we have - as expected - the value: zipcode =‘10004’,recordlD =‘36281’

What we are trying to do is double up on the single quotes so that the filter looks like zipcode =‘‘10004’’,recordlD =‘‘36281’’

Problem is that there are 2 or more filters and the request.AddParams doesn’t seem to handle that. If we add them one at a time only the last one is there. Attempting to add to useing request.AddParams[filter][x] fails. And if we convert to string by hand it just does not come out correctly.

How do we correctly use AddParams to add multiple paramaters with the same key?? Or alternatively, is there a way to edit the Params without doing a Delete/Add? (just changing request.Params had no effect)