Add trailing slash to all URLs calling the REST API

All the REST API URLs are registered with a trailing slash and if
you don't add the slash when calling the URL you get redirected.
This makes sure all URLs calling the API have the trailing slash.

Partially-Implements: blueprint horizon-lbaas-v2-ui
Change-Id: I8a4caeba9a8e1a8f3eebbe85b5d0d950ee4bcca0
This commit is contained in:
Justin Pomeroy 2016-03-09 16:44:47 -06:00
parent 350dc2aff5
commit e208757a24
2 changed files with 30 additions and 30 deletions

View File

@ -93,7 +93,7 @@
function getLoadBalancer(id, full) {
var params = { full: full };
return apiService.get('/api/lbaas/loadbalancers/' + id, { params: params })
return apiService.get('/api/lbaas/loadbalancers/' + id + '/', { params: params })
.error(function () {
toastService.add('error', gettext('Unable to retrieve load balancer.'));
});
@ -109,7 +109,7 @@
*/
function deleteLoadBalancer(id, quiet) {
var promise = apiService.delete('/api/lbaas/loadbalancers/' + id);
var promise = apiService.delete('/api/lbaas/loadbalancers/' + id + '/');
return quiet ? promise : promise.error(function () {
toastService.add('error', gettext('Unable to delete load balancer.'));
});
@ -140,7 +140,7 @@
*/
function editLoadBalancer(id, spec) {
return apiService.put('/api/lbaas/loadbalancers/' + id, spec)
return apiService.put('/api/lbaas/loadbalancers/' + id + '/', spec)
.error(function () {
toastService.add('error', gettext('Unable to update load balancer.'));
});
@ -184,7 +184,7 @@
var params = includeChildResources
? {'params': {'includeChildResources': includeChildResources}}
: {};
return apiService.get('/api/lbaas/listeners/' + id, params)
return apiService.get('/api/lbaas/listeners/' + id + '/', params)
.error(function () {
toastService.add('error', gettext('Unable to retrieve listener.'));
});
@ -216,7 +216,7 @@
*/
function editListener(id, spec) {
return apiService.put('/api/lbaas/listeners/' + id, spec)
return apiService.put('/api/lbaas/listeners/' + id + '/', spec)
.error(function () {
toastService.add('error', gettext('Unable to update listener.'));
});
@ -232,7 +232,7 @@
*/
function deleteListener(id, quiet) {
var promise = apiService.delete('/api/lbaas/listeners/' + id);
var promise = apiService.delete('/api/lbaas/listeners/' + id + '/');
return quiet ? promise : promise.error(function () {
toastService.add('error', gettext('Unable to delete listener.'));
});
@ -254,7 +254,7 @@
var params = includeChildResources
? {'params': {'includeChildResources': includeChildResources}}
: {};
return apiService.get('/api/lbaas/pools/' + id, params)
return apiService.get('/api/lbaas/pools/' + id + '/', params)
.error(function () {
toastService.add('error', gettext('Unable to retrieve pool.'));
});
@ -286,7 +286,7 @@
*/
function editPool(id, spec) {
return apiService.put('/api/lbaas/pools/' + id, spec)
return apiService.put('/api/lbaas/pools/' + id + '/', spec)
.error(function () {
toastService.add('error', gettext('Unable to update pool.'));
});
@ -302,7 +302,7 @@
*/
function deletePool(id, quiet) {
var promise = apiService.delete('/api/lbaas/pools/' + id);
var promise = apiService.delete('/api/lbaas/pools/' + id + '/');
return quiet ? promise : promise.error(function () {
toastService.add('error', gettext('Unable to delete pool.'));
});
@ -339,7 +339,7 @@
*/
function getMember(poolId, memberId) {
return apiService.get('/api/lbaas/pools/' + poolId + '/members/' + memberId)
return apiService.get('/api/lbaas/pools/' + poolId + '/members/' + memberId + '/')
.error(function () {
toastService.add('error', gettext('Unable to retrieve member.'));
});
@ -358,7 +358,7 @@
*/
function editMember(poolId, memberId, spec) {
return apiService.put('/api/lbaas/pools/' + poolId + '/members/' + memberId, spec)
return apiService.put('/api/lbaas/pools/' + poolId + '/members/' + memberId + '/', spec)
.error(function () {
toastService.add('error', gettext('Unable to update member.'));
});
@ -375,7 +375,7 @@
*/
function getHealthMonitor(monitorId) {
return apiService.get('/api/lbaas/healthmonitors/' + monitorId)
return apiService.get('/api/lbaas/healthmonitors/' + monitorId + '/')
.error(function () {
toastService.add('error', gettext('Unable to retrieve health monitor.'));
});
@ -392,7 +392,7 @@
*/
function editHealthMonitor(id, spec) {
return apiService.put('/api/lbaas/healthmonitors/' + id, spec)
return apiService.put('/api/lbaas/healthmonitors/' + id + '/', spec)
.error(function () {
toastService.add('error', gettext('Unable to update health monitor.'));
});
@ -408,7 +408,7 @@
*/
function deleteHealthMonitor(id, quiet) {
var promise = apiService.delete('/api/lbaas/healthmonitors/' + id);
var promise = apiService.delete('/api/lbaas/healthmonitors/' + id + '/');
return quiet ? promise : promise.error(function () {
toastService.add('error', gettext('Unable to delete health monitor.'));
});

View File

@ -47,7 +47,7 @@
{
func: 'getLoadBalancer',
method: 'get',
path: '/api/lbaas/loadbalancers/1234',
path: '/api/lbaas/loadbalancers/1234/',
error: 'Unable to retrieve load balancer.',
testInput: [ '1234', true ],
data: { params: { full: true } }
@ -55,7 +55,7 @@
{
func: 'deleteLoadBalancer',
method: 'delete',
path: '/api/lbaas/loadbalancers/1234',
path: '/api/lbaas/loadbalancers/1234/',
error: 'Unable to delete load balancer.',
testInput: [ '1234' ]
},
@ -77,7 +77,7 @@
{
func: 'getListener',
method: 'get',
path: '/api/lbaas/listeners/1234',
path: '/api/lbaas/listeners/1234/',
data: { params: { includeChildResources: true } },
error: 'Unable to retrieve listener.',
testInput: [ '1234', true ]
@ -85,7 +85,7 @@
{
func: 'getListener',
method: 'get',
path: '/api/lbaas/listeners/1234',
path: '/api/lbaas/listeners/1234/',
data: {},
error: 'Unable to retrieve listener.',
testInput: [ '1234', false ]
@ -93,7 +93,7 @@
{
func: 'getPool',
method: 'get',
path: '/api/lbaas/pools/1234',
path: '/api/lbaas/pools/1234/',
data: { params: { includeChildResources: true } },
error: 'Unable to retrieve pool.',
testInput: [ '1234', true ]
@ -101,7 +101,7 @@
{
func: 'getPool',
method: 'get',
path: '/api/lbaas/pools/1234',
path: '/api/lbaas/pools/1234/',
data: {},
error: 'Unable to retrieve pool.',
testInput: [ '1234', false ]
@ -109,7 +109,7 @@
{
func: 'deletePool',
method: 'delete',
path: '/api/lbaas/pools/1234',
path: '/api/lbaas/pools/1234/',
error: 'Unable to delete pool.',
testInput: [ '1234' ]
},
@ -123,14 +123,14 @@
{
func: 'getMember',
method: 'get',
path: '/api/lbaas/pools/1234/members/5678',
path: '/api/lbaas/pools/1234/members/5678/',
error: 'Unable to retrieve member.',
testInput: [ '1234', '5678' ]
},
{
func: 'editMember',
method: 'put',
path: '/api/lbaas/pools/1234/members/5678',
path: '/api/lbaas/pools/1234/members/5678/',
error: 'Unable to update member.',
data: { weight: 2 },
testInput: [ '1234', '5678', { weight: 2 } ]
@ -138,14 +138,14 @@
{
func: 'getHealthMonitor',
method: 'get',
path: '/api/lbaas/healthmonitors/1234',
path: '/api/lbaas/healthmonitors/1234/',
error: 'Unable to retrieve health monitor.',
testInput: [ '1234' ]
},
{
func: 'editHealthMonitor',
method: 'put',
path: '/api/lbaas/healthmonitors/1234',
path: '/api/lbaas/healthmonitors/1234/',
error: 'Unable to update health monitor.',
data: { name: 'healthmonitor-1' },
testInput: [ '1234', { name: 'healthmonitor-1' } ]
@ -153,7 +153,7 @@
{
func: 'deleteHealthMonitor',
method: 'delete',
path: '/api/lbaas/healthmonitors/1234',
path: '/api/lbaas/healthmonitors/1234/',
error: 'Unable to delete health monitor.',
testInput: [ '1234' ]
},
@ -168,7 +168,7 @@
{
func: 'editLoadBalancer',
method: 'put',
path: '/api/lbaas/loadbalancers/1234',
path: '/api/lbaas/loadbalancers/1234/',
error: 'Unable to update load balancer.',
data: { name: 'loadbalancer-1' },
testInput: [ '1234', { name: 'loadbalancer-1' } ]
@ -184,7 +184,7 @@
{
func: 'editListener',
method: 'put',
path: '/api/lbaas/listeners/1234',
path: '/api/lbaas/listeners/1234/',
error: 'Unable to update listener.',
data: { name: 'listener-1' },
testInput: [ '1234', { name: 'listener-1' } ]
@ -192,7 +192,7 @@
{
func: 'deleteListener',
method: 'delete',
path: '/api/lbaas/listeners/1234',
path: '/api/lbaas/listeners/1234/',
error: 'Unable to delete listener.',
testInput: [ '1234' ]
},
@ -207,7 +207,7 @@
{
func: 'editPool',
method: 'put',
path: '/api/lbaas/pools/1234',
path: '/api/lbaas/pools/1234/',
error: 'Unable to update pool.',
data: { name: 'pool-1' },
testInput: [ '1234', { name: 'pool-1' } ]