Permalink
Browse files

remove qs in `mapped`

issue #14
  • Loading branch information...
1 parent 92a5d66 commit 6594f8886cf798356fd442f13cfd1ade1f627774 @mpal9000 mpal9000 committed Dec 17, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/middleware/mapped.js
@@ -1,3 +1,5 @@
+var url = require('url')
+
module.exports = function(mappedPaths) {
var reverseMap = Object.create(null)
@@ -45,8 +47,11 @@ module.exports = function(mappedPaths) {
return next()
}
- req.url = reverseMap[req.url] || req.url
+ var parsedUrl = url.parse(req.url)
+ , origPath = reverseMap[parsedUrl.pathname]
+
+ if (origPath) req.url = origPath + parsedUrl.search
next()
}
}
-}
+}

0 comments on commit 6594f88

Please sign in to comment.