Ambassador icon indicating copy to clipboard operation
Ambassador copied to clipboard

Router mixing similar routes

Open pizerg opened this issue 5 years ago • 2 comments

Possible bug in Router, we have an api with two very similar paths /api/GetDevices and /api/GetDevice, while trying to ui test in iOS after setting up a response for each endpoint some times we're getting GetDevice's response for a call to GetDevices which makes the tests crash as the response is different and cannot be parsed by our app. I think the problem is in the matcher that sometimes is mixing responses in case of similar routes like ours.

pizerg avatar Jun 27 '19 12:06 pizerg

I'm seeing this as well -- in my case /workoutConfig is matching the /workout route. It appears to be variable as well -- sometimes it happens and sometimes it doesn't.

scottymac avatar Mar 08 '20 20:03 scottymac

So I took a look at the router and created some tests--turns out this is by design: paths are always treated as a regular expression. (Of course I realize now I should have clicked through to the above mentioned issue. 😂)

scottymac avatar Mar 08 '20 21:03 scottymac