Hi team, I am currently setting up <WireMock.Net>...
# help
m
Hi team, I am currently setting up WireMock.Net in my project and I am trying to create a mapping for a stub with query parameters using the FluentBuilder as shown on wiki . However, I am having trouble understanding how to add query parameters to my request. Here is a snippet of my code:
Copy code
var api = RestClient.For<IWireMockAdminApi>("http://localhost:5050");
var mappingBuilder = api.GetMappingBuilder();
mappingBuilder.Given(m => m
    .WithTitle("This is my title 1")
    .WithRequest(req => req
        .UsingGet()
        .WithPath("/my-path")
       .WithParams(??)  // I am not sure how to add query parameters here
    )
    .WithResponse(rsp => rsp
        .WithStatusCode(200)
        .WithBody("response body")
        .WithHeaders(h => h.Add("Content-Type", "application/json"))
    )
);
mappingBuilder.BuildAndPostAsync();
I see that there is a WithParams() method in the RequestModelBuilder, but I am not sure how to use it to add query parameters to my request. Could anyone provide an example or guide me on how to do this? Thank you in advance for your help.
l
Might be worth linking this in the #C059E0MBM29 channel
b