fix bug when path was nil
This commit is contained in:
parent
090e2c0811
commit
5166ae2c26
@ -48,7 +48,7 @@ module Rack
|
|||||||
else
|
else
|
||||||
status, headers, body = @app.call(env)
|
status, headers, body = @app.call(env)
|
||||||
|
|
||||||
if !@options[:ignore] || !@options[:ignore].any? { |filter| path[filter] }
|
if !@options[:ignore] || !@options[:ignore].any? { |filter| env['PATH_INFO'][filter] }
|
||||||
case headers['Content-Type']
|
case headers['Content-Type']
|
||||||
when %r{text/html}
|
when %r{text/html}
|
||||||
content_length = 0
|
content_length = 0
|
||||||
|
@ -135,12 +135,23 @@ describe Rack::LiveReload do
|
|||||||
|
|
||||||
context 'ignored' do
|
context 'ignored' do
|
||||||
let(:options) { { :ignore => [ %r{file} ] } }
|
let(:options) { { :ignore => [ %r{file} ] } }
|
||||||
let(:env) { { 'PATH_INFO' => 'this/file' } }
|
|
||||||
|
context 'not root' do
|
||||||
|
let(:env) { { 'PATH_INFO' => '/this/file' } }
|
||||||
|
|
||||||
it 'should have no change' do
|
it 'should have no change' do
|
||||||
body.should_not include('script')
|
body.should_not include('script')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'root' do
|
||||||
|
let(:env) { { 'PATH_INFO' => '/' } }
|
||||||
|
|
||||||
|
it 'should have script' do
|
||||||
|
body.should include('script')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context '/__rack/livereload.js' do
|
context '/__rack/livereload.js' do
|
||||||
|
Loading…
Reference in New Issue
Block a user