add the ability to ignore certain urls that may match
This commit is contained in:
parent
aaa701bac9
commit
20ef5cc1f3
|
@ -25,7 +25,8 @@ MyApp::Application.configure do
|
||||||
:min_delay => 500,
|
:min_delay => 500,
|
||||||
:max_delay => 10000,
|
:max_delay => 10000,
|
||||||
:port => 56789,
|
:port => 56789,
|
||||||
:host => 'myhost.cool.wow'
|
:host => 'myhost.cool.wow',
|
||||||
|
:ignore => [ %r{dont/modify\.html$} ]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
|
@ -48,6 +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] }
|
||||||
case headers['Content-Type']
|
case headers['Content-Type']
|
||||||
when %r{text/html}
|
when %r{text/html}
|
||||||
content_length = 0
|
content_length = 0
|
||||||
|
@ -78,6 +79,7 @@ module Rack
|
||||||
|
|
||||||
headers['Content-Length'] = content_length.to_s
|
headers['Content-Length'] = content_length.to_s
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
[ status, headers, body ]
|
[ status, headers, body ]
|
||||||
end
|
end
|
||||||
|
|
|
@ -132,6 +132,15 @@ describe Rack::LiveReload do
|
||||||
body.should include('localhost')
|
body.should include('localhost')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'ignored' do
|
||||||
|
let(:options) { { :ignore => [ %r{file} ] } }
|
||||||
|
let(:env) { { 'PATH_INFO' => 'this/file' } }
|
||||||
|
|
||||||
|
it 'should have no change' do
|
||||||
|
body.should_not include('script')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context '/__rack/livereload.js' do
|
context '/__rack/livereload.js' do
|
||||||
|
|
Loading…
Reference in New Issue