mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 21:40:13 +03:00
Require version param if ALLOWED_VERSIONS is set
Documentation: "ALLOWED_VERSIONS. If set, this value will restrict the set of versions that may be returned by the versioning scheme, and will raise an error if the provided version if not in this set."
This commit is contained in:
parent
ba951f3339
commit
c6b71055fd
|
@ -27,7 +27,7 @@ class BaseVersioning(object):
|
||||||
def is_allowed_version(self, version):
|
def is_allowed_version(self, version):
|
||||||
if not self.allowed_versions:
|
if not self.allowed_versions:
|
||||||
return True
|
return True
|
||||||
return (version == self.default_version) or (version in self.allowed_versions)
|
return version in self.allowed_versions
|
||||||
|
|
||||||
|
|
||||||
class AcceptHeaderVersioning(BaseVersioning):
|
class AcceptHeaderVersioning(BaseVersioning):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user