Skip to content

Commit 0cf18c4

Browse files
ykhtomchristie
authored andcommitted
Use Default Version in URLPathVersioning if 'version' Didn't Specified by Client (#6380)
* Use Default Version in URLPathVersioning if 'version' Didn't Passed * Clean Code
1 parent 4863a24 commit 0cf18c4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rest_framework/versioning.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ class URLPathVersioning(BaseVersioning):
7575

7676
def determine_version(self, request, *args, **kwargs):
7777
version = kwargs.get(self.version_param, self.default_version)
78+
if version is None:
79+
version = self.default_version
80+
7881
if not self.is_allowed_version(version):
7982
raise exceptions.NotFound(self.invalid_version_message)
8083
return version

0 commit comments

Comments
 (0)