merge
This commit is contained in:
commit
7733963658
|
@ -2,3 +2,4 @@
|
||||||
.bundle
|
.bundle
|
||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
pkg/*
|
pkg/*
|
||||||
|
*.orig
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require "rack/livereload"
|
require "rack/livereload"
|
||||||
|
|
||||||
class Rack::LiveReload
|
class Rack::LiveReload
|
||||||
VERSION = '0.3.3'
|
VERSION = '0.3.4'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ module Rack
|
||||||
new_body = body.dup
|
new_body = body.dup
|
||||||
|
|
||||||
if !ignored?(env['PATH_INFO']) && !bad_browser?(env['HTTP_USER_AGENT'])
|
if !ignored?(env['PATH_INFO']) && !bad_browser?(env['HTTP_USER_AGENT'])
|
||||||
if headers['Content-Type'][%r{text/html}]
|
if headers['Content-Type'] && headers['Content-Type'][%r{text/html}]
|
||||||
content_length = 0
|
content_length = 0
|
||||||
|
|
||||||
new_body = []
|
new_body = []
|
||||||
|
@ -78,7 +78,7 @@ module Rack
|
||||||
headers["X-Rack-LiveReload"] = '1'
|
headers["X-Rack-LiveReload"] = '1'
|
||||||
end
|
end
|
||||||
|
|
||||||
content_length += line.length
|
content_length += line.bytesize
|
||||||
|
|
||||||
new_body << line
|
new_body << line
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,6 +53,18 @@ describe Rack::LiveReload do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'unknown Content-Type' do
|
||||||
|
let(:ret) { [ 200, {}, [ 'hey ho' ] ] }
|
||||||
|
|
||||||
|
before do
|
||||||
|
app.stubs(:call).with(env).returns(ret)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not break' do
|
||||||
|
middleware.call(env).should_not raise_error(NoMethodError, /You have a nil object/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'text/html' do
|
context 'text/html' do
|
||||||
before do
|
before do
|
||||||
app.stubs(:call).with(env).returns([ 200, { 'Content-Type' => 'text/html', 'Content-Length' => 0 }, [ '<head></head>' ] ])
|
app.stubs(:call).with(env).returns([ 200, { 'Content-Type' => 'text/html', 'Content-Length' => 0 }, [ '<head></head>' ] ])
|
||||||
|
|
Loading…
Reference in New Issue