Permalink
Browse files

handle paths properly in Windows

  • Loading branch information...
1 parent 0eda184 commit 8aa6cc3725aa0df6e5d84d114a49532a58664f0e @rvagg rvagg committed with Dec 5, 2012
Showing with 2 additions and 1 deletion.
  1. +1 −1 st.js
  2. +1 −0 test/basic.js
View
2 st.js
@@ -169,7 +169,7 @@ Mount.prototype.getCacheOptions = function (opt) {
// get a path from a url
Mount.prototype.getPath = function (u) {
- u = path.join('/', url.parse(u).pathname).replace(/\\/g, '/')
+ u = path.normalize(url.parse(u).pathname.replace(/^[\/\\]?/, '/')).replace(/\\/g, '/')
if (u.indexOf(this.url) !== 0) return false;
// /a/b/c mounted on /path/to/z/d/x
View
1 test/basic.js
@@ -49,6 +49,7 @@ var stExpect = fs.readFileSync(require.resolve('../st.js')).toString()
test('simple request', function (t) {
req('/test/st.js', function (er, res, body) {
t.equal(res.statusCode, 200)
+ t.ok(/\/javascript$/.test(res.headers['content-type']))
t.ok(res.headers.etag)
stEtag = res.headers.etag
t.equal(body.toString(), stExpect)

0 comments on commit 8aa6cc3

Please sign in to comment.