From 998bc8d174806aa0ecaeb86405171f103518b2e4 Mon Sep 17 00:00:00 2001 From: Lucas Yang Date: Thu, 29 Dec 2016 06:04:19 +0800 Subject: [PATCH] add transformReponse function --- packages/rest/rest.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/rest/rest.js b/packages/rest/rest.js index d506c4a..f24eb82 100644 --- a/packages/rest/rest.js +++ b/packages/rest/rest.js @@ -45,6 +45,7 @@ Meteor.publish = function (name, handler, options) { 'url', 'getArgsFromRequest', 'httpMethod', + 'transformResponse', ]; var httpOptions = _.pick(options, httpOptionKeys); @@ -57,6 +58,9 @@ Meteor.publish = function (name, handler, options) { url: 'publications/' + name, getArgsFromRequest: defaultGetArgsFromRequest, httpMethod: 'get', + transformResponse: function(response) { + return response; + } }); JsonRoutes.add(httpOptions.httpMethod, httpOptions.url, function (req, res) { @@ -68,6 +72,7 @@ Meteor.publish = function (name, handler, options) { }); httpSubscription.on('ready', function (response) { + response = httpOptions.transformResponse(response); JsonRoutes.sendResult(res, {data: response}); });