Skip to content

Commit 26eecce

Browse files
smt116mboersma
authored andcommitted
fix(controller): do not require slash at the end of the GET /v2/users
Documentation includes sample code for listing all users using API. It shows `GET /v1/users` endpoint which did not work. API required a slash character at the end of URL. Make the slash optional so both, `GET /v1/users` and `GET /v1/users/` versions will work.
1 parent 926af04 commit 26eecce

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

rootfs/api/tests/test_users.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TestUsers(TestCase):
1111
fixtures = ['tests.json']
1212

1313
def test_super_user_can_list(self):
14-
url = '/v2/users/'
14+
url = '/v2/users'
1515

1616
user = User.objects.get(username='autotest')
1717
token = Token.objects.get(user=user)
@@ -23,7 +23,7 @@ def test_super_user_can_list(self):
2323
self.assertEqual(len(response.data['results']), 3)
2424

2525
def test_non_super_user_cannot_list(self):
26-
url = '/v2/users/'
26+
url = '/v2/users'
2727

2828
user = User.objects.get(username='autotest2')
2929
token = Token.objects.get(user=user)

rootfs/api/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@
103103
url(r'^certs/?',
104104
views.CertificateViewSet.as_view({'get': 'list', 'post': 'create'})),
105105
# list users
106-
url(r'^users/', views.UserView.as_view({'get': 'list'})),
106+
url(r'^users/?', views.UserView.as_view({'get': 'list'})),
107107
]

0 commit comments

Comments
 (0)