Creating a request with OData parameters that includes a comma #464

Closed
opened 2025-12-29 15:24:27 +01:00 by adam · 6 comments
Owner

Originally created by @loekensgard on GitHub (Oct 24, 2022).

Hi, I'm trying to create a wiremock response and request that matches on an OData query.

I'm trying to create a basic request like this:

public void SetUp(string body, string path) 
{
    var response = Response
       .Create()
       .WithBody(body)
       .WithHeader("content-type", "application/json; charset=utf-8")
       .WithStatusCode(200);
    
    var request = Request
       .Create()
       .WithPath(path)
       .WithParam("$filter", "startswith(name,'testName')")
       .UsingGet();
       
    _server.Given(request).RespondWith(response); 
}

I'm then faced with a problem where the response is returned as a partial match because of the request query, and if I inspect the query later on it appears as two queries (separated by the comma I guess).
image

Is there anything I can do to make sure that the query-value is not split by the comma?

Originally created by @loekensgard on GitHub (Oct 24, 2022). Hi, I'm trying to create a wiremock response and request that matches on an OData query. I'm trying to create a basic request like this: ```csharp public void SetUp(string body, string path) { var response = Response .Create() .WithBody(body) .WithHeader("content-type", "application/json; charset=utf-8") .WithStatusCode(200); var request = Request .Create() .WithPath(path) .WithParam("$filter", "startswith(name,'testName')") .UsingGet(); _server.Given(request).RespondWith(response); } ``` I'm then faced with a problem where the response is returned as a partial match because of the request query, and if I inspect the query later on it appears as two queries (separated by the comma I guess). ![image](https://user-images.githubusercontent.com/10920800/197513006-14d42b38-b411-4118-9029-9148e16e3903.png) Is there anything I can do to make sure that the query-value is not split by the comma?
adam added the question label 2025-12-29 15:24:27 +01:00
adam closed this issue 2025-12-29 15:24:28 +01:00
Author
Owner

@StefH commented on GitHub (Oct 24, 2022):

Hello @loekensgard

By default, the application does split on &, ; and ,.

However I've changed this.

In the settings, set the value QueryParameterMultipleValueSupport to a desired value.

This new functionality is in the preview version 1.5.8-ci-16573.

(https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)

@StefH commented on GitHub (Oct 24, 2022): Hello @loekensgard By default, the application does split on `&`, `;` and `,`. However I've changed this. In the settings, set the value `QueryParameterMultipleValueSupport` to a desired value. This new functionality is in the preview version `1.5.8-ci-16573`. (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)
Author
Owner

@StefH commented on GitHub (Oct 24, 2022):

https://github.com/WireMock-Net/WireMock.Net/pull/836

@StefH commented on GitHub (Oct 24, 2022): https://github.com/WireMock-Net/WireMock.Net/pull/836
Author
Owner

@StefH commented on GitHub (Oct 28, 2022):

@loekensgard Did you have time to test this preview version?

@StefH commented on GitHub (Oct 28, 2022): @loekensgard Did you have time to test this preview version?
Author
Owner

@StefH commented on GitHub (Nov 5, 2022):

@loekensgard Can you please test this?

@StefH commented on GitHub (Nov 5, 2022): @loekensgard Can you please test this?
Author
Owner

@loekensgard commented on GitHub (Nov 8, 2022):

@StefH
Hi, sorry for my late reply.
I did not get it to work, I tried to specify the QueryParameterMultipleValueSupport but it did not change the output for me. I ended up URL encoding my query params and then it worked without using the preview version. 😄

@loekensgard commented on GitHub (Nov 8, 2022): @StefH Hi, sorry for my late reply. I did not get it to work, I tried to specify the QueryParameterMultipleValueSupport but it did not change the output for me. I ended up URL encoding my query params and then it worked without using the preview version. 😄
Author
Owner

@StefH commented on GitHub (Nov 8, 2022):

@loekensgard
Good to hear that you found another way.

(Note that I will still merge the PR to master, just to be more flexible in the future)

@StefH commented on GitHub (Nov 8, 2022): @loekensgard Good to hear that you found another way. (Note that I will still merge the PR to master, just to be more flexible in the future)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#464