From 1424e83c586e5f96f100f9cc4f6dd1fca09b62cd Mon Sep 17 00:00:00 2001 From: Guilherme Cirne Date: Mon, 17 Feb 2014 14:27:35 -0300 Subject: [PATCH 1/2] Method for clearing handler cache. --- lib/application.js | 10 +++++++++- test/app.test.js | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/application.js b/lib/application.js index d1c2b17e3..f2d321866 100644 --- a/lib/application.js +++ b/lib/application.js @@ -249,7 +249,7 @@ app.docs = function (options) { swagger(remotes, options); } -/*! +/** * Get a handler of the specified type from the handler cache. */ @@ -264,6 +264,14 @@ app.handler = function (type) { return handler; } +/** + * Clears handler of the specified type from the handler cache. + */ + +app.clearHandlerCache = function (type) { + this._handlers[type] = undefined; +} + /** * An object to store dataSource instances. */ diff --git a/test/app.test.js b/test/app.test.js index 701d22fe7..60ceadd76 100644 --- a/test/app.test.js +++ b/test/app.test.js @@ -85,6 +85,14 @@ describe('app', function() { }); }); + describe('app.clearHandlerCache(type)', function() { + it('clears handler of given type from cache', function() { + var restHandler = app.handler('rest'); + app.clearHandlerCache('rest'); + expect(restHandler).to.not.equal(app.handler('rest')); + }); + }); + describe('app.boot([options])', function () { beforeEach(function () { app.boot({ From 2da9e9c1571742dd16d5fe0e9b45fcd3d9a0e7e8 Mon Sep 17 00:00:00 2001 From: Guilherme Cirne Date: Mon, 17 Feb 2014 17:48:28 -0300 Subject: [PATCH 2/2] Whitespace. Forces new jenkins build. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 39b891251..a9faab6dd 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,4 @@ Read about the [features of LoopBack](https://github.com/strongloop/loopback/wik A brief guide for [contributing to LoopBack projects](https://github.com/strongloop/loopback/wiki/How-To-Contribute). [![githalytics.com alpha](https://cruel-carlota.pagodabox.com/8caf6b5cce4be4d13c01ea9aafc9f407 "githalytics.com")](http://githalytics.com/strongloop/loopback) +