From 3db25d6a673ec1cb47ad718390c94d485d51a1a5 Mon Sep 17 00:00:00 2001 From: Igor Dralyuk Date: Wed, 2 Nov 2011 17:52:57 -0700 Subject: [PATCH] Added response monkey patching. --- modules/engine/lib/engine/http.request.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/engine/lib/engine/http.request.js b/modules/engine/lib/engine/http.request.js index 948c6305..dc28f496 100644 --- a/modules/engine/lib/engine/http.request.js +++ b/modules/engine/lib/engine/http.request.js @@ -409,6 +409,16 @@ function sendOneRequest(args, resourceUri, params, holder, cb) { } if(res.statusCode >= 200 && res.statusCode <= 300) { if(respJson) { + if(resource.monkeyPatch && resource.monkeyPatch['patch response']) { + try { + respJson = resource.monkeyPatch['patch response']({ + body: respJson + }); + } + catch(e) { + return httpReqTx.cb(e); + } + } // Projections project.run(resource.resultSet, statement, respJson, function(filtered) { return httpReqTx.cb(undefined, {