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
This commit is contained in:
Yaser Khahani 2019-01-08 15:04:54 +03:30 committed by Tom Christie
parent 4863a24451
commit 0cf18c4163

View File

@ -75,6 +75,9 @@ class URLPathVersioning(BaseVersioning):
def determine_version(self, request, *args, **kwargs):
version = kwargs.get(self.version_param, self.default_version)
if version is None:
version = self.default_version
if not self.is_allowed_version(version):
raise exceptions.NotFound(self.invalid_version_message)
return version