[Groonga-commit] groonga/express-droonga [master] Activate JSONP correctly

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Mar 25 15:16:02 JST 2013


YUKI Hiroshi	2013-03-25 15:16:02 +0900 (Mon, 25 Mar 2013)

  New Revision: 65f82586b95974c480b0347d46b0fd69ab90cc3c
  https://github.com/groonga/express-droonga/commit/65f82586b95974c480b0347d46b0fd69ab90cc3c

  Message:
    Activate JSONP correctly

  Modified files:
    lib/frontend/rest-adaptor.js

  Modified: lib/frontend/rest-adaptor.js (+2 -8)
===================================================================
--- lib/frontend/rest-adaptor.js    2013-03-25 14:38:01 +0900 (e7604c7)
+++ lib/frontend/rest-adaptor.js    2013-03-25 15:16:02 +0900 (6c075d6)
@@ -22,16 +22,14 @@ function createHandler(params) {
       function(error, envelope) {
         if (error) {
           var body = envelope && envelope.body || null;
-          response.contentType('application/json');
-          response.send(body, error);
+          response.jsonp(body, error);
         } else {
           var body = envelope.body;
           if (definition.toClient) {
             var result = definition.toClient(commandName, body);
             body = result[1];
           }
-          response.contentType('application/json');
-          response.send(body, 200);
+          response.jsonp(body, 200);
         }
       },
       { timeout: timeout }
@@ -88,10 +86,6 @@ exports.register = function(application, params) {
                               handler:    handler });
   });
 
-  application.configure(function() {
-    application.enable('jsonp callback');
-  });
-
   application.configure('production', function() {
     application.set('json spaces', -1); // disable pretty print
   });
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index