1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 22:03:36 +00:00

Move all non-gets to POST in API to avoid CORS preflight

This commit is contained in:
Kyle Spearrin
2016-07-13 20:03:57 -04:00
parent 0838eff6bf
commit e3b98dbda4

View File

@@ -9,37 +9,37 @@
get: { method: 'GET', params: { id: '@id' } }, get: { method: 'GET', params: { id: '@id' } },
list: { method: 'GET', params: {} }, list: { method: 'GET', params: {} },
post: { method: 'POST', params: {} }, post: { method: 'POST', params: {} },
put: { method: 'PUT', params: { id: '@id' } }, put: { method: 'POST', params: { id: '@id' } },
del: { method: 'DELETE', params: { id: '@id' } } del: { method: 'POST', params: { id: '@id/delete' } }
}); });
_service.folders = $resource(_apiUri + '/folders/:id', {}, { _service.folders = $resource(_apiUri + '/folders/:id', {}, {
get: { method: 'GET', params: { id: '@id' } }, get: { method: 'GET', params: { id: '@id' } },
list: { method: 'GET', params: {} }, list: { method: 'GET', params: {} },
post: { method: 'POST', params: {} }, post: { method: 'POST', params: {} },
put: { method: 'PUT', params: { id: '@id' } }, put: { method: 'POST', params: { id: '@id' } },
del: { method: 'DELETE', params: { id: '@id' } } del: { method: 'POST', params: { id: '@id/delete' } }
}); });
_service.ciphers = $resource(_apiUri + '/ciphers/:id', {}, { _service.ciphers = $resource(_apiUri + '/ciphers/:id', {}, {
get: { method: 'GET', params: { id: '@id' } }, get: { method: 'GET', params: { id: '@id' } },
list: { method: 'GET', params: {} }, list: { method: 'GET', params: {} },
'import': { url: _apiUri + '/ciphers/import', method: 'POST', params: {} }, 'import': { url: _apiUri + '/ciphers/import', method: 'POST', params: {} },
favorite: { url: _apiUri + '/ciphers/:id/favorite', method: 'PUT', params: { id: '@id' } }, favorite: { url: _apiUri + '/ciphers/:id/favorite', method: 'POST', params: { id: '@id' } },
del: { method: 'DELETE', params: { id: '@id' } } del: { method: 'POST', params: { id: '@id/delete' } }
}); });
_service.accounts = $resource(_apiUri + '/accounts', {}, { _service.accounts = $resource(_apiUri + '/accounts', {}, {
register: { url: _apiUri + '/accounts/register', method: 'POST', params: {} }, register: { url: _apiUri + '/accounts/register', method: 'POST', params: {} },
emailToken: { url: _apiUri + '/accounts/email-token', method: 'POST', params: {} }, emailToken: { url: _apiUri + '/accounts/email-token', method: 'POST', params: {} },
email: { url: _apiUri + '/accounts/email', method: 'PUT', params: {} }, email: { url: _apiUri + '/accounts/email', method: 'POST', params: {} },
putPassword: { url: _apiUri + '/accounts/password', method: 'PUT', params: {} }, putPassword: { url: _apiUri + '/accounts/password', method: 'POST', params: {} },
getProfile: { url: _apiUri + '/accounts/profile', method: 'GET', 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: {} }, 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: {} }, 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: {} }, 'import': { url: _apiUri + '/accounts/import', method: 'POST', params: {} },
postDelete: { url: _apiUri + '/accounts/delete', method: 'POST', params: {} } postDelete: { url: _apiUri + '/accounts/delete', method: 'POST', params: {} }
}); });