Skip to content

Commit cef896f

Browse files
authored
Merge pull request #4 from drostehk/master
Support bound methods
2 parents 7646a75 + 570e032 commit cef896f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fastapi_versioning/routing.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@ def versioned_api_route(
1111
class VersionedAPIRoute(route_class):
1212
def __init__(self, *args, **kwargs):
1313
super().__init__(*args, **kwargs)
14-
self.endpoint._api_version = (major, minor)
14+
try:
15+
self.endpoint._api_version = (major, minor)
16+
except AttributeError:
17+
# Support bound methods
18+
self.endpoint.__func__._api_version = (major, minor)
1519
return VersionedAPIRoute

0 commit comments

Comments
 (0)