PagerDuty / pdpyras

Low-level PagerDuty REST/Events API client for Python
MIT License
129 stars 29 forks source link

Handle exact path matches #109

Closed asmith-pd closed 1 year ago

asmith-pd commented 1 year ago

This PR fixes the handling of exact path matches by checking if the requested path is an exact match for any of the patterns when more than 1 pattern matches.

For example, before this PR, a request for /users/me fails due to matching multiple paths:-

Exception: Ambiguous URL /users/me matches more than one canonical path pattern: /users/{id}, /users/me; 
  this is likely a bug.

After this PR, it works as expected:-

{
│   'name': 'Andy Smith',
│   'email': 'asmith@pagerduty.com',
│   'time_zone': 'America/Denver',
...
}
Deconstrained commented 1 year ago

Nice catch!