Navigation Menu

Skip to content

Commit

Permalink
Support GET requests for "/droonga/:messageType" HTTP API
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jun 24, 2014
1 parent d214a5c commit d4d6001
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 11 additions & 1 deletion lib/adapter/api/droonga.js
@@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions test/adapter/http.test.js
Expand Up @@ -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"] }]);
});
Expand Down

0 comments on commit d4d6001

Please sign in to comment.