Skip to content

Commit

Permalink
Merge pull request #4 from drostehk/master
Browse files Browse the repository at this point in the history
Support bound methods
  • Loading branch information
DeanWay authored Jun 8, 2020
2 parents 7646a75 + 570e032 commit cef896f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fastapi_versioning/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ def versioned_api_route(
class VersionedAPIRoute(route_class):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.endpoint._api_version = (major, minor)
try:
self.endpoint._api_version = (major, minor)
except AttributeError:
# Support bound methods
self.endpoint.__func__._api_version = (major, minor)
return VersionedAPIRoute

0 comments on commit cef896f

Please sign in to comment.