Permalink
Browse files

Adding server fix for #422, #402

  • Loading branch information...
1 parent bb08480 commit 1e426cfd19e1036f40da8b8c46d91d5b05ccb227 @addyosmani committed Sep 14, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 cli/tasks/server.js
View
@@ -413,8 +413,7 @@ module.exports = function(grunt) {
opts = opts || {};
return function inject(req, res, next) {
- var port = res.socket.server.address().port;
-
+
// build filepath from req.url and deal with index files for trailing `/`
var filepath = req.url.slice(-1) === '/' ? req.url + 'index.html' : req.url;
@@ -424,6 +423,8 @@ module.exports = function(grunt) {
return next();
}
+ var port = res.socket.server.address().port;
+
// setup some basic headers, at this point it's always text/html anyway
res.setHeader('Content-Type', connect.static.mime.lookup(filepath));

0 comments on commit 1e426cf

Please sign in to comment.