mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Wrong Request Match result is returning #32
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 @kailashravuri on GitHub (Jun 20, 2017).
Originally assigned to: @StefH on GitHub.
Hi - I downloaded the code and while running the ConsoleApplication Project inthe sulution with some changes i am getting some bizarre results.
In the attached sample code file - when i try to run the run application and accessing the URL from browser - like http://localhost:9091/search/query i am getting the result of path match for url "/testmatch".
If i register the url "/search/query" above "/testmatch" and try to browse http://localhost:9091/search/query i am getting the result of "/search/query" but if try "/testmatch" still getting the result of "search/query"
If i move the code up and down for registering urls, It is always returning the first one irrespective of path i am accessing from browser.
MainApp.txt
@phillee007 commented on GitHub (Jun 20, 2017):
Try removing the EnablePartialMapping line and see if that fixes it.
@StefH commented on GitHub (Jun 20, 2017):
There are some errors:
Remove this line :
server.SetBasicAuthentication("a", "b");// this line means that you want to protect the server with basic authemticationUse
WithPathinstead ofWithUrlAnd
WithBodyAsJsoncan be used more easily like:WithBodyAsJson(new { value = "test" }And
If you want to change prio, add
AtPriority. See wiki here:https://github.com/WireMock-Net/WireMock.Net/wiki/Stubbing-and-Request-Matching#stub-priority
@kailashravuri commented on GitHub (Jun 22, 2017):
Hi @StefH
I need the authentication and i am passing user ID and password using postman. As you mentioned i removed
AllowPartialMappingthen i am getting result for "/search/query" but "No matching mapping found" for '/testpath'@StefH commented on GitHub (Jun 22, 2017):
Did you change your code to use
WithPath?@kailashravuri commented on GitHub (Jun 22, 2017):
@StefH yaa it looks like
WithPathis working fine. Sorry for missing that last time. Thanks for helping me out.@StefH commented on GitHub (Jun 22, 2017):
Ok. If you have more questions or ideas, please ask.