Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add verbose logging

  • Loading branch information...
commit ab2d96f309780f98718dfbf9ba6a0ed0eae9b60b 1 parent 38486b4
@maxogden authored
Showing with 6 additions and 2 deletions.
  1. +5 −1 index.js
  2. +1 −1  test/index.js
View
6 index.js
@@ -18,11 +18,15 @@ function Rewriter(tako, rewrites, options) {
rewrites = self.normalizePaths(rewrites)
_.each(rewrites, function(rewrite) {
- console.log(rewrite.to)
+ if (self.opts.verbose) console.log(self.scrubPassword(rewrite.to))
self.proxyRequest(rewrite)
})
}
+Rewriter.prototype.scrubPassword = function(url) {
+ return url.replace(/^(https?:\/\/[^@:]+):[^@]+@/, '$1:******@')
+}
+
Rewriter.prototype.resolveSymbols = function(to, params, query) {
var self = this
_.each(params, function(val, param) {
View
2  test/index.js
@@ -45,6 +45,6 @@ var tako = require('tako')
;
var t = tako()
- new Rewriter(t, rewrites, {root: "http://localhost:5984/datacouch/_design/datacouch", attachments: path.resolve(__dirname, 'attachments')})
+ new Rewriter(t, rewrites, {verbose: true, root: "http://localhost:5984/datacouch/_design/datacouch", attachments: path.resolve(__dirname, 'attachments')})
t.httpServer.listen(9999)
console.log('listening on 9999')
Please sign in to comment.
Something went wrong with that request. Please try again.