YUKI Hiroshi
null+****@clear*****
Tue Jun 24 18:24:47 JST 2014
YUKI Hiroshi 2014-06-24 18:24:47 +0900 (Tue, 24 Jun 2014) New Revision: d4d6001f91f353eb4b91d4756544f00d74946677 https://github.com/droonga/express-droonga/commit/d4d6001f91f353eb4b91d4756544f00d74946677 Message: Support GET requests for "/droonga/:messageType" HTTP API Modified files: lib/adapter/api/droonga.js test/adapter/http.test.js Modified: lib/adapter/api/droonga.js (+11 -1) =================================================================== --- lib/adapter/api/droonga.js 2014-05-29 22:44:10 +0900 (f6e55bc) +++ lib/adapter/api/droonga.js 2014-06-24 18:24:47 +0900 (ed2e041) @@ -1,8 +1,18 @@ var command = require('../command'); module.exports = { + 'droonga-get': new command.HTTPRequestResponse({ + method: 'GET', + path: '/droonga/:messageType', + onRequest: function(request, connection) { + var messageType = request.params.messageType; + var body = {}; + body.timeout = body.timeout || 1000; + connection.emit(messageType, body); + } + }), // XXX dangerous! this must be disabled on public services. - 'droonga': new command.HTTPRequestResponse({ + 'droonga-post': new command.HTTPRequestResponse({ method: 'POST', path: '/droonga/:messageType', onRequest: function(request, connection) { Modified: test/adapter/http.test.js (+4 -2) =================================================================== --- test/adapter/http.test.js 2014-05-29 22:44:10 +0900 (fb86fc0) +++ test/adapter/http.test.js 2014-06-24 18:24:47 +0900 (de7cc17) @@ -39,8 +39,10 @@ suite('HTTP Adapter', function() { definition: groongaAPI.groonga }, { name: 'groonga-post', definition: groongaAPI['groonga-post'] }, - { name: 'droonga', - definition: droongaAPI.droonga }, + { name: 'droonga-get', + definition: droongaAPI['droonga-get'] }, + { name: 'droonga-post', + definition: droongaAPI['droonga-post'] }, { name: 'droonga-streaming:watch', definition: droongaAPI["droonga-streaming:watch"] }]); }); -------------- next part -------------- HTML����������������������������... Download