Skip to content

Commit

Permalink
Parse the key from the body of /admin/lookup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Dijk committed Oct 9, 2015
1 parent 2805bc2 commit 0473b9b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server/admin/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
// THE SOFTWARE.
'use strict';

var safeParse = require('../../lib/util.js').safeParse;

module.exports = function createLookupHandler(ringpop) {
return function handleLookup(arg1, arg2, hostInfo, callback) {
var key = arg2.toString();
callback(null, null, JSON.stringify({
dest: ringpop.lookup(key)
}));
var body = safeParse(arg2.toString());
if (body && body.key) {
callback(null, null, JSON.stringify({
dest: ringpop.lookup(body.key)
}));
}
};
};

0 comments on commit 0473b9b

Please sign in to comment.