From f8cf28a2dd5948a6f46dc95bf3418b24be7c6b2e Mon Sep 17 00:00:00 2001
From: Zachary Carter <zack.carter@gmail.com>
Date: Thu, 28 Jun 2012 16:01:30 -0700
Subject: [PATCH] Forward /wsapi/fake_verification to browserid

---
 bin/router | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/bin/router b/bin/router
index 54007a715..a912e05e7 100755
--- a/bin/router
+++ b/bin/router
@@ -121,7 +121,19 @@ if (config.get('verifier_url')) {
 // fake_verification.js.  This is used during testing only and should
 // never be included in a production deployment
 if (process.env['BROWSERID_FAKE_VERIFICATION']) {
-  require('../lib/browserid/fake_verification.js').addVerificationWSAPI(app);
+  app.use(function(req, res, next) {
+    if (url.parse(req.url).pathname == '/wsapi/fake_verification') {
+      forward(
+        browserid_url+req.url, req, res,
+        function(err) {
+          if (err) {
+            logger.error("error forwarding request:", err);
+          }
+        });
+    } else {
+      return next();
+    }
+  });
 }
 
 // handle /wsapi reads/writes
-- 
GitLab