Use DELETE method instead of GET for key removal

This commit is contained in:
Tankred Hase
2016-06-14 16:46:17 +02:00
parent 1a7b57777b
commit 7d93b882a5
4 changed files with 11 additions and 8 deletions

View File

@@ -51,6 +51,9 @@ router.post('/api/v1/key', function *() {
router.get('/api/v1/key', function *() {
yield rest.query(this);
});
router.del('/api/v1/key', function *() {
yield rest.remove(this);
});
// Redirect all http traffic to https
app.use(function *(next) {

View File

@@ -56,7 +56,7 @@ class REST {
*/
*query(ctx) {
let op = ctx.query.op;
if (this[op]) {
if (op === 'verify' || op === 'verifyRemove') {
return yield this[op](ctx); // delegate operation
}
// do READ if no 'op' provided