From e3b98dbda4d91d6d9cd5402ed6b5aa904e7b5499 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 13 Jul 2016 20:03:57 -0400 Subject: [PATCH] Move all non-gets to POST in API to avoid CORS preflight --- src/Vault/wwwroot/app/services/apiService.js | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Vault/wwwroot/app/services/apiService.js b/src/Vault/wwwroot/app/services/apiService.js index 3b72cd74f7..42da05abea 100644 --- a/src/Vault/wwwroot/app/services/apiService.js +++ b/src/Vault/wwwroot/app/services/apiService.js @@ -9,37 +9,37 @@ get: { method: 'GET', params: { id: '@id' } }, list: { method: 'GET', params: {} }, post: { method: 'POST', params: {} }, - put: { method: 'PUT', params: { id: '@id' } }, - del: { method: 'DELETE', params: { id: '@id' } } + put: { method: 'POST', params: { id: '@id' } }, + del: { method: 'POST', params: { id: '@id/delete' } } }); _service.folders = $resource(_apiUri + '/folders/:id', {}, { get: { method: 'GET', params: { id: '@id' } }, list: { method: 'GET', params: {} }, post: { method: 'POST', params: {} }, - put: { method: 'PUT', params: { id: '@id' } }, - del: { method: 'DELETE', params: { id: '@id' } } + put: { method: 'POST', params: { id: '@id' } }, + del: { method: 'POST', params: { id: '@id/delete' } } }); _service.ciphers = $resource(_apiUri + '/ciphers/:id', {}, { get: { method: 'GET', params: { id: '@id' } }, list: { method: 'GET', params: {} }, 'import': { url: _apiUri + '/ciphers/import', method: 'POST', params: {} }, - favorite: { url: _apiUri + '/ciphers/:id/favorite', method: 'PUT', params: { id: '@id' } }, - del: { method: 'DELETE', params: { id: '@id' } } + favorite: { url: _apiUri + '/ciphers/:id/favorite', method: 'POST', params: { id: '@id' } }, + del: { method: 'POST', params: { id: '@id/delete' } } }); _service.accounts = $resource(_apiUri + '/accounts', {}, { register: { url: _apiUri + '/accounts/register', method: 'POST', params: {} }, emailToken: { url: _apiUri + '/accounts/email-token', method: 'POST', params: {} }, - email: { url: _apiUri + '/accounts/email', method: 'PUT', params: {} }, - putPassword: { url: _apiUri + '/accounts/password', method: 'PUT', params: {} }, + email: { url: _apiUri + '/accounts/email', method: 'POST', params: {} }, + putPassword: { url: _apiUri + '/accounts/password', method: 'POST', params: {} }, getProfile: { url: _apiUri + '/accounts/profile', method: 'GET', params: {} }, - putProfile: { url: _apiUri + '/accounts/profile', method: 'PUT', params: {} }, + putProfile: { url: _apiUri + '/accounts/profile', method: 'POST', params: {} }, getTwoFactor: { url: _apiUri + '/accounts/two-factor', method: 'GET', params: {} }, - putTwoFactor: { url: _apiUri + '/accounts/two-factor', method: 'PUT', params: {} }, + putTwoFactor: { url: _apiUri + '/accounts/two-factor', method: 'POST', params: {} }, postPasswordHint: { url: _apiUri + '/accounts/password-hint', method: 'POST', params: {} }, - putSecurityStamp: { url: _apiUri + '/accounts/security-stamp', method: 'PUT', params: {} }, + putSecurityStamp: { url: _apiUri + '/accounts/security-stamp', method: 'POST', params: {} }, 'import': { url: _apiUri + '/accounts/import', method: 'POST', params: {} }, postDelete: { url: _apiUri + '/accounts/delete', method: 'POST', params: {} } });