commit
2eae7fd1bb
@ -59,7 +59,8 @@ module Rack
|
||||
else
|
||||
status, headers, body = result = @app.call(env)
|
||||
|
||||
if (headers['Content-Type'] and headers['Content-Type']['text/event-stream']) or
|
||||
if (headers['Content-Type'] and (headers['Content-Type']['text/event-stream'] or
|
||||
headers['Content-Type'][%r{^image/}])) or
|
||||
headers['Transfer-Encoding'] == 'chunked' or
|
||||
headers['Content-Disposition'] =~ %r{^inline}
|
||||
return result
|
||||
|
@ -53,7 +53,7 @@ describe Rack::LiveReload do
|
||||
end
|
||||
|
||||
context 'not text/html' do
|
||||
let(:ret) { [ 200, { 'Content-Type' => 'image/png' }, [ '<head></head>' ] ] }
|
||||
let(:ret) { [ 200, { 'Content-Type' => 'application/pdf' }, [ '<head></head>' ] ] }
|
||||
|
||||
before do
|
||||
app.stubs(:call).with(env).returns(ret)
|
||||
@ -64,6 +64,21 @@ describe Rack::LiveReload do
|
||||
end
|
||||
end
|
||||
|
||||
context 'image/png' do
|
||||
let(:body) { [ '<head></head>' ] }
|
||||
let(:ret) { [ 200, { 'Content-Type' => 'image/png' }, body ] }
|
||||
|
||||
before do
|
||||
app.stubs(:call).with(env).returns(ret)
|
||||
body.expects(:close).never
|
||||
body.stubs(:respond_to?).with(:close).returns(true)
|
||||
end
|
||||
|
||||
it 'should pass through' do
|
||||
middleware.call(env).should == ret
|
||||
end
|
||||
end
|
||||
|
||||
context 'text/event-stram' do
|
||||
let(:body) { [ '<head></head>' ] }
|
||||
let(:ret) { [ 200, { 'Content-Type' => 'text/event-stream' }, body ] }
|
||||
|
Loading…
Reference in New Issue
Block a user