Skip to content

Commit

Permalink
Support bound methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tijptjik authored Apr 15, 2020
1 parent 75ac7cb commit 570e032
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 570e032

Please sign in to comment.