Request not matching when query parameter value contains comma char. #474

Closed
opened 2025-12-29 15:24:40 +01:00 by adam · 1 comment
Owner

Originally created by @Morshed11218 on GitHub (Dec 5, 2022).

Hi,
I'm noticing that the request matcher fails to match a request with param value containing comma (,) char.

"WireMock.Net" Version="1.5.12"

Example code:
`

        var mockServer = WireMockServer.StartWithAdminInterface();

        var requestId = Guid.NewGuid();

        var paramVal = "cat,dog";

        mockServer
              .Given(
                Request.Create().WithPath("/some/thing").WithParam("test", paramVal).UsingGet()
              )
              .WithGuid(requestId)
              .RespondWith(
                Response.Create()
                  .WithStatusCode(200)
                  .WithHeader("Content-Type", "text/plain")
                  .WithBody("Request found!")
              );

        var client = mockServer.CreateClient();

        var response = await client.GetAsync($"{mockServer.Url}/some/thing?test={paramVal}");
        var content = await response.Content.ReadAsStringAsync();

        Console.WriteLine(content);

        client.Dispose();
        mockServer.Dispose();
        mockServer.Stop();

`
Result:
{"Status":"No matching mapping found"}

When I remove the comma from the param value, it works.

Originally created by @Morshed11218 on GitHub (Dec 5, 2022). Hi, I'm noticing that the request matcher fails to match a request with param value containing comma (,) char. "WireMock.Net" Version="1.5.12" Example code: ` var mockServer = WireMockServer.StartWithAdminInterface(); var requestId = Guid.NewGuid(); var paramVal = "cat,dog"; mockServer .Given( Request.Create().WithPath("/some/thing").WithParam("test", paramVal).UsingGet() ) .WithGuid(requestId) .RespondWith( Response.Create() .WithStatusCode(200) .WithHeader("Content-Type", "text/plain") .WithBody("Request found!") ); var client = mockServer.CreateClient(); var response = await client.GetAsync($"{mockServer.Url}/some/thing?test={paramVal}"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); client.Dispose(); mockServer.Dispose(); mockServer.Stop(); ` Result: {"Status":"No matching mapping found"} When I remove the comma from the param value, it works.
adam added the question label 2025-12-29 15:24:40 +01:00
adam closed this issue 2025-12-29 15:24:40 +01:00
Author
Owner

@Morshed11218 commented on GitHub (Dec 6, 2022):

Closing request as it's not an issue. Saw the option for QueryParameterMultipleValueSupport.

@Morshed11218 commented on GitHub (Dec 6, 2022): Closing request as it's not an issue. Saw the option for QueryParameterMultipleValueSupport.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#474