isaacs/st — pull request #13 by rvagg (2012-12-05 09:53:41+00:00)
Title: handle paths properly in Windows

I'm having to deploy on Windows so I picked this one up. It's an odd one, but the summary is that doing a `path.join('/', '/foo/bar')` on windows results in the UNC path `'\\foo\bar\'` (even though just `'/foo'` is fine). Surprisingly this works out OK downstream *except* for mime-type detection. `'/styles/foo.css'` ends up as `'/styles/foo.css/'` which doesn't get a mime-type, which isn't such a good thing.

My solution is to fix the path with `.replace()` to make sure it has a leading `'/'` and then do a `path.normalize()` on that (like `path.join()` does, so we're effectively synthesizing a join).

Added an extra test to make sure `'content-type'` comes out right, but it's not entirely necessary since other tests in *basic* were failing on Windows. All pass after this change.