-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Similar endpoints #49
Comments
We have the same problem. router["/reisen"] = AdvancedResponse(stubFile: "ReisenResponse", mapper: mapper)
router["/reisen/details"] = AdvancedResponse(stubFile: "ReiseDetailsResponse", mapper: mapper) returns always |
Yeah we have the same problems with a test that requieres mutiple calls to a service with similar paths, the In our case we added these search paths:
The second will get the response from the first since Regex will match with the first path it finds, causing the loop to end early without checking if there are more positive matches. |
I had a similar issue #51 , as a workaround we're using a custom DefaultRouter class with the following route matcher:
|
As they are regex strings, we can add
|
When I ran this code from Router class in Playgrounds always print "matches" for similar endpoints. In my case, Ambassador is returning the same JSON response to both endpoints and I don't know why...Is there a chance that similar endpoints make Ambassador confused? (Sometimes work sometimes don't)
`
let path = "foo/bar/10/xyz"
let searchPath = "foo/bar/10/xyz/asd"
let regex = try! NSRegularExpression(pattern: path, options: [])
let matches = regex.matches(in: searchPath, options: [], range: NSRange(location: 0, length: searchPath.count))
if !matches.isEmpty {
print("match")
} else {
print("no match")
}
`
The text was updated successfully, but these errors were encountered: