ensure some sort of host for rack::mockrequests that don't provide one
This commit is contained in:
parent
1e884ba174
commit
d4c8e8cf96
|
@ -54,7 +54,7 @@ module Rack
|
||||||
|
|
||||||
body.each do |line|
|
body.each do |line|
|
||||||
if !headers['X-Rack-LiveReload'] && line['</head>']
|
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?
|
if use_vendored?
|
||||||
src = LIVERELOAD_JS_PATH.dup + "?host=#{host_to_use}"
|
src = LIVERELOAD_JS_PATH.dup + "?host=#{host_to_use}"
|
||||||
|
|
|
@ -124,6 +124,14 @@ describe Rack::LiveReload do
|
||||||
body.should_not include('web_socket')
|
body.should_not include('web_socket')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'no host at all' do
|
||||||
|
let(:env) { {} }
|
||||||
|
|
||||||
|
it 'should use localhost' do
|
||||||
|
body.should include('localhost')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context '/__rack/livereload.js' do
|
context '/__rack/livereload.js' do
|
||||||
|
|
Loading…
Reference in New Issue