mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 22:04:48 +03:00
Merge 486a8f82b2
into 9b56dda918
This commit is contained in:
commit
b6f581f89a
|
@ -23,7 +23,10 @@ def apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required):
|
|||
|
||||
else:
|
||||
# Regular URL pattern
|
||||
regex = urlpattern.regex.pattern.rstrip('$').rstrip('/') + suffix_pattern
|
||||
regex = urlpattern.regex.pattern.rstrip('$')
|
||||
if regex[-1:] == '/':
|
||||
regex += '?'
|
||||
regex += suffix_pattern
|
||||
view = urlpattern._callback or urlpattern._callback_str
|
||||
kwargs = urlpattern.default_args
|
||||
name = urlpattern.name
|
||||
|
|
|
@ -47,7 +47,7 @@ class FormatSuffixTests(TestCase):
|
|||
|
||||
test_paths = [
|
||||
(URLTestPath('/test.api', (), {'format': 'api'}), True),
|
||||
(URLTestPath('/test/.api', (), {'format': 'api'}), False),
|
||||
(URLTestPath('/test/.api', (), {'format': 'api'}), True),
|
||||
(URLTestPath('/test.api/', (), {'format': 'api'}), True),
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user