Skip to content

Commit

Permalink
Merge pull request #109 from isotes/serve-html
Browse files Browse the repository at this point in the history
Mime type for HTML files and support index.html
  • Loading branch information
thibaudgg committed May 22, 2014
2 parents e614064 + 4fedb31 commit 3d01dad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/guard/livereload/websocket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def dispatch(data)
parser << data
# prepend with '.' to make request url usable as a file path
request_path = '.' + URI.parse(parser.request_url).path
request_path += '/index.html' if File.directory? request_path
if parser.http_method != 'GET' || parser.upgrade?
super #pass the request to websocket
elsif request_path == './livereload.js'
Expand All @@ -33,7 +34,8 @@ def _serve_file(path)
end

def _content_type(path)
case File.extname(path)
case File.extname(path).downcase
when '.html', '.htm' then 'text/html'
when '.css' then 'text/css'
when '.js' then 'application/ecmascript'
when '.gif' then 'image/gif'
Expand Down

0 comments on commit 3d01dad

Please sign in to comment.