YUKI Hiroshi
null+****@clear*****
Mon Apr 28 11:39:04 JST 2014
YUKI Hiroshi 2014-04-28 11:39:04 +0900 (Mon, 28 Apr 2014) New Revision: 9b41a409820a4e3ad3ad397916b8988347868551 https://github.com/droonga/express-droonga/commit/9b41a409820a4e3ad3ad397916b8988347868551 Message: groonga: Support ".json" optional suffix Modified files: lib/adapter/api/groonga.js Modified: lib/adapter/api/groonga.js (+20 -7) =================================================================== --- lib/adapter/api/groonga.js 2014-04-25 17:09:06 +0900 (e23ce8e) +++ lib/adapter/api/groonga.js 2014-04-28 11:39:04 +0900 (ae9afc6) @@ -145,19 +145,32 @@ Loader.prototype._sendResponse = function _sendResponse(body) { this._response.jsonp(groongaResponse, httpStatusCode); }; +function handleHTTPRequest(request, connection) { + connection.emit(request.params.commandName, request.query); +} + +function handleLoadHTTPRequest(request, connection) { + var loader = new Loader(request, response, connection, this.logger); + loader.run(); +} + module.exports = { 'groonga': new command.HTTPRequestResponse({ path: '/d/:commandName', - onRequest: function(request, connection) { - connection.emit(request.params.commandName, request.query); - } + onRequest: handleHTTPRequest + }), + 'groonga': new command.HTTPRequestResponse({ + path: '/d/:commandName.json', + onRequest: handleHTTPRequest }), 'groonga-load': new command.HTTPRequestResponse({ method: 'POST', path: '/d/load', - onRequest: function(request, connection, response) { - var loader = new Loader(request, response, connection, this.logger); - loader.run(); - } + onRequest: handleLoadHTTPRequest + }), + 'groonga-load': new command.HTTPRequestResponse({ + method: 'POST', + path: '/d/load.json', + onRequest: handleLoadHTTPRequest }) }; -------------- next part -------------- HTML����������������������������...Download