pass images through
This commit is contained in:
parent
03ea0608cd
commit
698ae43650
|
@ -59,7 +59,8 @@ module Rack
|
||||||
else
|
else
|
||||||
status, headers, body = result = @app.call(env)
|
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['Transfer-Encoding'] == 'chunked' or
|
||||||
headers['Content-Disposition'] =~ %r{^inline}
|
headers['Content-Disposition'] =~ %r{^inline}
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -53,7 +53,7 @@ describe Rack::LiveReload do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'not text/html' do
|
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
|
before do
|
||||||
app.stubs(:call).with(env).returns(ret)
|
app.stubs(:call).with(env).returns(ret)
|
||||||
|
@ -64,6 +64,21 @@ describe Rack::LiveReload do
|
||||||
end
|
end
|
||||||
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
|
context 'text/event-stram' do
|
||||||
let(:body) { [ '<head></head>' ] }
|
let(:body) { [ '<head></head>' ] }
|
||||||
let(:ret) { [ 200, { 'Content-Type' => 'text/event-stream' }, body ] }
|
let(:ret) { [ 200, { 'Content-Type' => 'text/event-stream' }, body ] }
|
||||||
|
|
Loading…
Reference in New Issue