mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Matching WithParam on OData End Points #52
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @christamlyn-bridge on GitHub (Dec 12, 2017).
Originally assigned to: @StefH on GitHub.
Our test is making an HTTP call to an OData end point:
http://localhost:5021/navision/OData/Company('My Company')/School()?$filter=(substringof(Code, 'WA')To match to this I have mocked:
In the tests this is matching on the client request, however if I try and specify the parameter value it fails to match:
Is there any reason why using the value in the WithParam method would cause a mismatch?
Thanks
@StefH commented on GitHub (Dec 12, 2017):
Problem was related to url-encoding.
See new NuGet : https://www.nuget.org/packages/WireMock.Net/1.0.2.10
@christamlyn-bridge commented on GitHub (Dec 13, 2017):
interestingly after upgrading to 1.0.2.10, none of my requests are matching now
@StefH commented on GitHub (Dec 13, 2017):
Can you checkout the example code? (https://github.com/WireMock-Net/WireMock.Net/blob/master/examples/WireMock.Net.ConsoleApplication/MainApp.cs#L43)
I tried this:
It could be related to
server.AllowPartialMapping();?@christamlyn-bridge commented on GitHub (Dec 13, 2017):
ah I see the difference, on the previous version I found I had to escape the spaces manually in my WilcardMatcher:
.WithPath(new WildcardMatcher("/navision/OData/Company('My%20Company')/School*", true))But with the new module, you can use:
.WithPath(new WildcardMatcher("/navision/OData/Company('My Company')/School*", true))Definite improvement! Thanks
@StefH commented on GitHub (Dec 13, 2017):
Yes indeed. Escaping in your strings is not needed.
If all is fine, you can close this issue ?
@StefH commented on GitHub (Dec 13, 2017):
Thanks for testing. If you have more questions, just ask!