Merge branch 'master' of github.com:johnbintz/rack-livereload

This commit is contained in:
John Bintz 2011-11-29 14:02:34 -05:00
commit 141d5632ee
2 changed files with 9 additions and 1 deletions

View File

@ -54,7 +54,7 @@ module Rack
body.each do |line|
if !headers['X-Rack-LiveReload'] && line['</head>']
host_to_use = @options[:host] || env['HTTP_HOST'].gsub(%r{:.*}, '')
host_to_use = (@options[:host] || env['HTTP_HOST'] || 'localhost').gsub(%r{:.*}, '')
if use_vendored?
src = LIVERELOAD_JS_PATH.dup + "?host=#{host_to_use}"

View File

@ -124,6 +124,14 @@ describe Rack::LiveReload do
body.should_not include('web_socket')
end
end
context 'no host at all' do
let(:env) { {} }
it 'should use localhost' do
body.should include('localhost')
end
end
end
context '/__rack/livereload.js' do